08-29-2018, 06:59 AM
I had a sample (snippet) script of this but I can not find it anymore.
It is (seems) very simple,
I have 3 buttons:
- One button [B1] toggles BS_ICON style on the RIGHT button
- One button [B2] outputs if BS_ICON style has been set on the RIGHT button
- The third button (which is displayed on the right), is the button on which the style BS_ICON will be set
Below I have the dialog ready but I can't get it to work (tried different flags in SetWinStyle).
Initially you see both icon and text on [TEST BUTTON].
- But when clicking on button [B1] I want to toggle the style BS_ICON on the button [TEST BUTTON] (add/remove style).
- Button [B2] outputs if style BS_ICON on [TEST BUTTON] has been set or not set.
[B2] seems to work because it outputs correctly when setting/unsetting BS_ICON through dialog editor.
Function set_style_exampel
It is (seems) very simple,
I have 3 buttons:
- One button [B1] toggles BS_ICON style on the RIGHT button
- One button [B2] outputs if BS_ICON style has been set on the RIGHT button
- The third button (which is displayed on the right), is the button on which the style BS_ICON will be set
Below I have the dialog ready but I can't get it to work (tried different flags in SetWinStyle).
Initially you see both icon and text on [TEST BUTTON].
- But when clicking on button [B1] I want to toggle the style BS_ICON on the button [TEST BUTTON] (add/remove style).
- Button [B2] outputs if style BS_ICON on [TEST BUTTON] has been set or not set.
[B2] seems to work because it outputs correctly when setting/unsetting BS_ICON through dialog editor.
Function set_style_exampel
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 241 159 "Dialog"
;3 Button 0x54032000 0x0 5 11 80 28 "[B1] toggle button style of ''test button''"
;4 Button 0x54032000 0x0 95 34 80 28 "[TEST BUTTON]"
;6 Button 0x54032000 0x4 6 44 80 29 "[B2] Output if[]BS_ICON has been set[]"
;5 Static 0x54000000 0x0 5 92 216 26 "Clicking [B1]:[]Should either display text ''TEST BUTTON'' or display ONLY icon on the button [TEST BUTTON]. (It should remove OR add style BS_ICON)"
;7 Static 0x54000000 0x4 5 122 216 26 "Clicking [B2]:[]Should output if BS_ICON is set or not set on the button [TEST BUTTON]"
;END DIALOG
;DIALOG EDITOR: "" 0x2040601 "*" "" "" ""
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,,SendMessage(id(4 hDlg) BM_SETIMAGE IMAGE_ICON GetFileIcon("$qm$\mouse.ico"))
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3
,,SetWinStyle (id(4 hDlg)) BS_ICON 1|4|8|16
,case 6
,,int st=GetWinStyle(id(4 hDlg))
,,if(st&BS_ICON)
,,,out "BS_ICON style has been set!"
,,else
,,,out "BS_ICON style has NOT been set."
ret 1