Posts: 1,006
Threads: 330
Joined: Mar 2007
Hi,
I would like to add fonts, color, and background to the text and buttons of some of my dialogs. Is this easy?
Stuart
Posts: 12,140
Threads: 142
Joined: Dec 2002
In subject you say 'toolbar', in message - 'dialog'. Do you mean 'toolbar in dialog'?
Posts: 1,006
Threads: 330
Joined: Mar 2007
Yes, Gintaras - Dialog buttons - that is what I meant.
Thanks,
Stuart
Posts: 12,140
Threads: 142
Joined: Dec 2002
Button colors cannot be changed. Only font. See samples in samples2.qml file.
Posts: 1,006
Threads: 330
Joined: Mar 2007
Hi Gintaras,
I geuss if I can't change the color of the button, I could use a image file rather than a simple button as the trigger but then I would lose the "BS_PUSHLIKE" functionality I now have - i.e. it turns on or off another macro depending on whether the if(but(lParam)) returns 0 or 1.
Any suggestions?
Thanks,
Stuart
Posts: 12,140
Threads: 142
Joined: Dec 2002
Use a Static on top.
Function Dialog34
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("Dialog34" &Dialog34)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;4 Static 0x54000000 0x0 20 10 26 8 "Text"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 8 6 48 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,__Font-- f
,f.SetDialogFontColor(hDlg 0xff0000 "4")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3 mes "button"
,case IDOK
,case IDCANCEL
ret 1
Posts: 771
Threads: 264
Joined: Jul 2012
Sorry to kick this old topic (in the interest of keeping things in one place I replied in this topic in stead of opening a new one).
Is it still impossible to directly set the color of the button text? (meaning the "static on top"-method should still be used).
EDIT: When I use this example (above) then the blue static disappears when I hover above the button (even with "topmost" style).
Posts: 12,140
Threads: 142
Joined: Dec 2002
Quote:Is it still impossible to directly set the color of the button text?
Difficult.
http://stackoverflow.com/questions/6302 ... text-color
Quote:When I use this example (above) then the blue static disappears when I hover above the button
Try to remove WS_CLIPSIBLINGS style from Static.
Macro
Macro2500
\Dialog_Editor
str dd=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;4 Static 0x50000000 0x0 20 10 26 8 "Text"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 8 6 48 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""
if(!ShowDialog(dd &sub.DlgProc)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,DT_SetTextColor hDlg 0xff0000 "4"
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3 mes "button"
,case IDOK
,case IDCANCEL
ret 1
Posts: 771
Threads: 264
Joined: Jul 2012