cambio font su molteplici oggetti "say"

Moderator: Enrico Maria Giordano

Post Reply
User avatar
max
Posts: 122
Joined: Fri Jun 30, 2006 2:14 pm
Location: Ancona - Italy

cambio font su molteplici oggetti "say"

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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"
{
...
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
max
Posts: 122
Joined: Fri Jun 30, 2006 2:14 pm
Location: Ancona - Italy

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply