Page 1 of 1

cambio font su molteplici oggetti "say"

Posted: Tue Sep 02, 2008 10:12 am
by max
Ho una dialog abbastanza complessa con numerosi oggetti testo statici (say) scritti su una risorsa esterna attraverso workshop.
Ad alcuni di questi vorrei dare un certo font per evidenziarli dagli altri.
C'è un modo più semplificato che non procedere uno per uno con la REDEFINE, così come ho fatto finora? (vedi sotto)

local fnt1,oDLG,oSAY1,oSAY2,oSAY3,...., oSAY100
REDEFINE oSAY1 ID 1 of oDLG FONT fnt1
REDEFINE oSAY2 ID 2 of oDLG FONT fnt1
REDEFINE oSAY3 ID 3 of oDLG FONT fnt1
....
...
REDEFINE oSAY100 ID 100 of oDLG FONT fnt1

MT

FWH 8.04 - XHARBOUR 1.1.0

Posted: Tue Sep 02, 2008 11:17 am
by Antonio Linares
Max,

When you build your dialogbox in the resources editor, you can set the font to use from it. In the RC it will be specified like this:

test DIALOG 40, 33, 194, 119
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "This is a test"
FONT 8, "MS Sans Serif"
{
...
}

Posted: Tue Sep 02, 2008 12:15 pm
by max
Antonio,
ok i can specify one font in my resource, but i need to declare one font not for all may object say but only just for some of them.
And another font for other type of say , ecc.ecc.
And if i don't wrong in the resource editor i can specify only one font, valid for all objects and controls of the dialogbox.

Or there is a syntax in the resource editor for declaring multiple font in the same dialogbox, assigning one font to each control?

Thank you.
bye

Max

Posted: Tue Sep 02, 2008 3:21 pm
by Antonio Linares
Max,

To use different fonts you have to do it programmatically:

Code: Select all

ACTIVATE DIALOG oDlg ;
   ON INIT SetDifferentFonts( oDlg )

...

function SetDifferentFonts( oDlg )

   local n

   for n = 1 to Len( oDlg:aControls )
      do case
          case Upper( oDlg:aControls[ n ]:ClassName() ) == "TSAY"
                  oDlg:aControls[ n ]:SetFont( oFontForSays )

          ...
      endcase
   next

return nil