FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Font of a dialog box which is build by resources
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Font of a dialog box which is build by resources
Posted: Wed Dec 03, 2025 10:00 AM

Hello,

I build my dialogboxes by resources.

The font of the dialog box is set in its defintion like this:

1_BG_DBFVELD3 DIALOG LOADONCALL MOVEABLE DISCARDABLE 37, 19, 300, 351
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 10, "MS Sans Serif"

Is it possible to change this font when executing my application?

Thank you very much in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Font of a dialog box which is build by resources
Posted: Wed Dec 03, 2025 11:34 AM

LOADONCALL, MOVEABLE and DISCARDABLE are old stuff from 16 bit era. You must remove them. For the font, yes, you can change the font. Here it is a sample:

#include "Fivewin.ch"


FUNCTION MAIN()

LOCAL oDlg, oFnt

DEFINE FONT oFnt NAME "Segoe UI" SIZE 0, -20

DEFINE DIALOG oDlg;
       RESOURCE "TEST";
       FONT oFnt

ACTIVATE DIALOG oDlg;
         CENTER

RELEASE FONT oFnt

RETURN NIL
TEST DIALOG 0, 0, 300, 300
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "Segoe UI"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "This is a test", -1, "STATIC", SS_LEFT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE, 85, 95, 85, 15
}
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Font of a dialog box which is build by resources
Posted: Wed Dec 03, 2025 03:47 PM

Thanks, Enrico, for trying to help me.

If I use the definition of the font the way you suggested, only the letters within my dialog box changes. The size of the dialogbox is not adapted.

If I change the size of the font in the resource definition, the letters within my dialog box changes, but the size of the dialogbox is adapted too.

So, a big font results into a bigger dialogbox.

Any suggestion?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Font of a dialog box which is build by resources
Posted: Wed Dec 03, 2025 04:25 PM

If I understand correctly, I would use DIFFERENT DIALOGUES for each case: IF...ELSIF...ELSE...ENDIF.

Si entiendo correctamente, utilizaría DIÁLOGOS DIFERENTES para cada caso: IF...ELSIF...ELSE...ENDIF.

1_BG_DBFVELD3 DIALOG 206, 56, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 8, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Button", 302, 234, 198, 50, 14
}

2_BG_DBFVELD3 DIALOG 116, 31, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 10, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Button", 302, 234, 198, 50, 14
}

3_BG_DBFVELD3 DIALOG 91, 28, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 12, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Button", 302, 234, 198, 50, 14
}

4_BG_DBFVELD3 DIALOG 66, 11, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 14, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Button", 302, 234, 198, 50, 14
}

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Font of a dialog box which is build by resources
Posted: Wed Dec 03, 2025 05:31 PM
// C:\FWH\SAMPLES\DRIESSEN.PRG /RC

#include "FiveWin.ch"

#Define CLR_LGRAY     nRGB( 230, 230, 230 )
#Define CLR_LGREEN    nRGB( 190, 215, 190 )
#Define CLR_AMARELO   nRGB( 255, 255, 000 )  //--> Amarelo Para o Fundo

#Define CLR_WINDOW    nRgb( 130, 130, 130 )  // 16 // COR DO WINDOWS DEFINIDA 16 BITS

Static oWnd, lAbertura := .F.

FUNCTION Main()

   LOCAL oIco, oBar, oBmp, oPopUp, oPopUp2, oPopUp3, oPopUp4, oPopUp5, oFont
   LOCAL oBtn := ARRAY(05)
   LOCAL cWidth := 500, cHeight := 500
   LOCAL nStarted := 1, hBorland

   hBorland := LoadLibrary( "BWCC32.dll" )

   BWCCRegister( GetResources() )  // Resources Borland.

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14
   DEFINE ICON oIco FILE "..\icons\fax.ico"

   DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
      TITLE "FiveWin sample"              ;
      MENU  BuildMenu()                   ;
      COLOR "B/W"                         ;
      ICON oIco

   DEFINE BUTTONBAR oBar _3D SIZE 50, 40 OF oWnd 2007

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\new.bmp" FLAT            ;
      ACTION ( DRIENSSEN_DLG( nStarted := "1" ) )                            ;
      TOOLTIP "Creates a new document"

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\open.bmp" FLAT           ;
      ACTION ( DRIENSSEN_DLG( nStarted := "2" ) )                            ;
      TOOLTIP "Opens a document"

   GetnWidthItem( 0.8 ) // Ajusta con un valor < 1, y comprueba 0.8

   MENU oPopUp POPUP 2007 COLORS HEIGHT 2.27 FONT oFont

  MENUITEM "Cadastro de Clientes"                                        ;
     FILENAME "..\bitmaps\16x16\new.bmp"                                 ;
     MESSAGE "Cadastro de Clientes - Pesquisas."                         ;
     ACTION MsgInfo( Time() )

  SEPARATOR
  MENUITEM "Cadastro de Grupos"                                          ;
     FILENAME "..\bitmaps\16x16\open.bmp"                                ;
     MESSAGE "Cadastro de Grupos - Textos Auxiliares."                   ;
     ACTION MsgInfo( Time() )

  SEPARATOR
  MENUITEM "Cadastro de Ferramentas"                                     ;
      FILENAME "..\bitmaps\16x16\printer.bmp"                            ;
     MESSAGE OemToAnsi( "Cadastro de Ferramentas da Proposta" )          ;
     ACTION MsgInfo( Time() )

  SEPARATOR
  MENUITEM "Cadastro de Mão de Obra"                                     ;
     FILENAME "..\bitmaps\16x16\prop.bmp"                                ;
     MESSAGE OemToAnsi( "Cadastro de MÆo de Obra" )                      ;
     ACTION MsgInfo( Time() )

  SEPARATOR
  MENUITEM "Cadastro de Paisagistas"                                     ;
     FILENAME "..\bitmaps\16x16\Help.bmp"                                ;
     MESSAGE OemToAnsi( "Cadastro de Paisagistas da Empresa" )           ;
     ACTION MsgInfo( Time() )

   ENDMENU

   DEFINE BUTTON oBtn[03] OF oBar ACTION oBtn[03]:ShowPopup() FLAT GROUP     ;
      FILENAME "..\bitmaps\16x16\floppy.bmp"                                 ;
      MESSAGE "Saves this document"                                          ;
      TOOLTIP "Saves this document"                                          ;
      MENU oPopup

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\printer.bmp" FLAT GROUP  ;
      ACTION ( DRIENSSEN_DLG( nStarted := "3" ) )                            ;
      TOOLTIP "Print this document"

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\prop.bmp" FLAT GROUP     ;
      ACTION ( DRIENSSEN_DLG( nStarted := "4" ) )                            ;
      TOOLTIP "Setup the printer"

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\HelpInd.bmp" FLAT        ;
      ACTION MsgInfo( Version() ) TOOLTIP "A multiple lines" +               ;
      Chr( 13 ) + Chr( 10 ) + "tooltip!" GROUP

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Help.bmp" FLAT           ;
      ACTION MsgInfo( "fivewin power!" ) TOOLTIP "fivewin power!"

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT           ;
      ACTION oWnd:End() TOOLTIP "Exit this app" GROUP

   DEFINE MESSAGE OF oWnd ;
      PROMPT FWVERSION + " " + FWCOPYRIGHT ;
      NOINSET CENTERED KEYBOARD DATE CLOCK 2007

   DEFINE BITMAP oBmp FILENAME "..\bitmaps\fiveback.bmp"

   oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }

   ACTIVATE WINDOW oWnd ;
      VALID MsgYesNo( "Do you want to quit ?" )

   oFont:End()

RETURN NIL

FUNCTION BuildMenu()

   LOCAL oMenu

   MENU oMenu 2007
      MENUITEM "Information"
      MENU
         MENUITEM "&About..." ;
            ACTION MsgInfo( FWDESCRIPTION ) ;
            FILENAME "..\bitmaps\16x16\info.bmp"
         SEPARATOR
         MENUITEM "&End..."  ;
            ACTION oWnd:End() FILENAME "..\bitmaps\16x16\exit.bmp"

  ENDMENU

  MENUITEM "&Clients"
  MENU
     MENUITEM "&New..." ;
        ACTION ( MsgStop( "New Clients" ),;
                 oWnd:Say( 5, 5, "New Clients...", "GR+/G" ) ) ;
        FILENAME "..\bitmaps\16x16\faces.bmp"

     MENUITEM "&Modify..."  ACTION MsgInfo( "Modif. Clients" ) ;
        FILENAME "..\bitmaps\edit.bmp"

     MENUITEM "&Delete..."  ACTION MsgAlert( "Del Clients" ) ;
        FILENAME "..\bitmaps\16x16\delete.bmp"

     SEPARATOR

     MENUITEM "&Browse..."  ACTION MsgInfo( "Browse Clients" ) ;
        FILENAME "..\bitmaps\16x16\browse.bmp"

  ENDMENU

  MENUITEM "&Utilities"
  MENU
     MENUITEM "&Calculator..." ACTION WinExec( "Calc" ) ;
        FILENAME "..\bitmaps\16x16\calc.bmp"

     MENUITEM "&Internet..." ;
        ACTION WinExec( "start iexplore www.fivetech.com", 0 ) ;
        FILENAME "..\bitmaps\16x16\explorer.bmp"
  ENDMENU
   ENDMENU

RETURN( oMenu )

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   local nRow := 0, nCol := 0, n
   local nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   if oBmp:hBitmap == 0
      return nil
   endif

   while nRow < nHeight
      nCol = 0
      while nCol < nWidth
         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
         nCol += nBmpWidth
      end
      nRow += nBmpHeight
   end

return nil

FUNCTION DRIENSSEN_DLG( nStarted )

   LOCAL oDlg, oFnt, oFont, oSaida

   IF( nStarted = "1" )

  DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 0,  14 BOLD
  DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 0, -14 BOLD

  DEFINE DIALOG oDlg RESOURCE "1_BG_DBFVELD3" FONT oFont

   ELSEIF( nStarted = "2" )

  DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 0,  16 BOLD
  DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 0, -16 BOLD

  DEFINE DIALOG oDlg RESOURCE "2_BG_DBFVELD3" FONT oFont

   ELSEIF( nStarted = "3" )

  DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 0,  18 BOLD
  DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 0, -18 BOLD

  DEFINE DIALOG oDlg RESOURCE "3_BG_DBFVELD3" FONT oFont

   ELSEIF( nStarted = "4" )

  DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 0,  20 BOLD
  DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 0, -20 BOLD

  DEFINE DIALOG oDlg RESOURCE "4_BG_DBFVELD3" FONT oFont

   ENDIF

   oDlg:lHelpIcon := .F.

   REDEFINE BUTTONBMP oSaida ID 302 OF oDlg                             ;
      ACTION ( oDlg:End() ) CANCEL

   oSaida:cToolTip := OemToAnsi( "Saida - Exit - Cancelar" )

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End() 
   oFnt:End()  

RETURN NIL

DLL32 FUNCTION BWCCRegister( hInst AS LONG ) AS WORD PASCAL LIB "BWCC32.DLL"

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Font of a dialog box which is build by resources
Posted: Wed Dec 03, 2025 05:32 PM
1_BG_DBFVELD3 DIALOG 206, 56, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 8, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Exit", 302, 234, 198, 50, 14
}

2_BG_DBFVELD3 DIALOG 116, 31, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 10, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Exit", 302, 234, 198, 50, 14
}

3_BG_DBFVELD3 DIALOG 91, 28, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 12, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Exit", 302, 234, 198, 50, 14
}

4_BG_DBFVELD3 DIALOG 66, 11, 300, 222
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CLASS "BorDlg_Gray"
CAPTION "Geef de gegevens van het invulveld in"
FONT 14, "MS Sans Serif"
{
 PUSHBUTTON "Button", 301, 31, 198, 50, 14
 PUSHBUTTON "Exit", 302, 234, 198, 50, 14
}

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion