Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Questions about "fonts" in QM
#1
Dear Gintaras,

Let me start saying that I am sorry if I am asking things that either I should have known and/or I could have found in help topics or in the forum. I would like that you clarify some issues regarding fonts unless there exists a tutorial I could read :

1. What is the difference between statements :
Quote:fTask.SetFont(id(4 hDlg))
g.SetDialogFont(hDlg "11")
where
Quote:CFont+ fTask
and
__Font-



2. What is exactly variable _hfont and how it may be used. For example if the font is changed in a dialog field, I wonder whether statement

Quote:SendMessageW (id(10 hDlg)) WM_SETFONT _hfont 0

is the only way to restore _hfont ?

3. Is there a way to create a new font, starting with _hfont but with bold characters?

Many thanks in advance - Best regards.
#2
1. CFont - I don't remember what it is, I guess something from forum. __Font is in System. It sends WM_SETFONT message to all specified controls; I guess CFont too.

2. _hfont now is undocumented. It is used in System functions. It is default dialog font handle. Another way to restore changed font - send WM_GETFONT before changing, save the handle in a thread variable, then send WM_SETFONT to restore.

3. __Font.Create has parameter templateFont. It can be a font or a special value, eg 1 is dialog font.

Macro Macro632
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Static 0x54000000 0x0 8 8 48 12 "Normal"
;4 Static 0x54000000 0x0 8 24 48 12 "Bold"
;5 Button 0x54032000 0x0 64 24 48 14 "Change"
;6 Button 0x54032000 0x0 116 24 48 14 "Restore"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,;create bold font, using dialog font as template
,__Font- t_f.Create("" 0 1 0 1 4)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;Change
,int- t_oldFont
,if(t_oldFont=0) t_oldFont=SendDlgItemMessage(hDlg 4 WM_GETFONT 0 0)
,t_f.SetDialogFont(hDlg "4")
,
,case 6 ;;Restore
,if(t_oldFont) SendDlgItemMessage(hDlg 4 WM_SETFONT t_oldFont 1); t_oldFont=0
ret 1

To get a copy of _hfont:
__Font- t_f.Create("" 0 0 0 1)
#3
Thank you very much, indeed! It is now clear to me.


Forum Jump:


Users browsing this thread: 1 Guest(s)