Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get and Set style of button (BS_ICON)
#4
to toggle it back and forth do this ron
also need to make sure to remove icon when dialog closes

Code:
Copy      Help
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
,int-- t_style
sel message
,case WM_INITDIALOG
,int hi=GetFileIcon("$qm$\mouse.ico")
,SendMessage(id(4 hDlg) BM_SETIMAGE IMAGE_ICON hi)
,case WM_DESTROY
,DestroyIcon hi

,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3
,t_style=!t_style
,if t_style
,,SetWinStyle (id(4 hDlg)) BS_ICON 1|16
,else
,,SetWinStyle (id(4 hDlg)) BS_ICON 2|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


Messages In This Thread
Get and Set style of button (BS_ICON) - by r0n - 08-29-2018, 06:59 AM
RE: Get and Set style of button (BS_ICON) - by Kevin - 08-29-2018, 03:14 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)