09-09-2016, 05:25 AM
I understand it is not easy to change the background color of a system button (OK, Cancel) (topic : Rich Edit on Toolbar Buttons and Text).
To overcome it, I wrote a simple-sample dialog to add an icon to "OK" button :
Function ColorButtonDlg_Reset
I would appreciate it if I could have any advice on the following issues :
1. How could I reset the "OK" button back to its default state? I found empirically that it can be done with a BM_SETIMAGE with handle=0. However, I am nt sure that this is right.
2. Is it possible to have both icon + text on the same button? There is relevant information in QM help, Dialog Editor, Styles, BS_ICON but I failed to set it up.
Many thanks in advance.
To overcome it, I wrote a simple-sample dialog to add an icon to "OK" button :
Function ColorButtonDlg_Reset
;https://msdn.microsoft.com/en-us/library/windows/desktop/bb761822(v=vs.85).aspx
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 214 78 "Dialog"
;3 Button 0x54032000 0x0 23 11 48 14 "Set"
;4 Button 0x54032000 0x0 89 11 48 14 "Reset"
;1 Button 0x54034040 0x4 66 59 48 14 "OK"
;2 Button 0x54030000 0x4 130 59 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
int- handle
sel message
,case WM_INITDIALOG
,handle=GetFileIcon("%IconFol%\red_light.ico" 0 0)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,out "set"
,out handle
,SendMessage(id(1 hDlg) BM_SETIMAGE IMAGE_ICON handle)
,
,case 4
,out "Reset"
,SendMessage(id(1 hDlg) BM_SETIMAGE IMAGE_ICON 0)
,
,case IDOK
,case IDCANCEL
ret 1
I would appreciate it if I could have any advice on the following issues :
1. How could I reset the "OK" button back to its default state? I found empirically that it can be done with a BM_SETIMAGE with handle=0. However, I am nt sure that this is right.
2. Is it possible to have both icon + text on the same button? There is relevant information in QM help, Dialog Editor, Styles, BS_ICON but I failed to set it up.
Many thanks in advance.