04-20-2013, 05:26 AM
To make code shorter and clear arranged can use 1 button to start-stop.
Function Dialog2
Could also do the enabling in 1 line. Thought maybe hard to read.
,case 3 ;; start-stop button must have BS_PUSHLIKE and BS_AUTOCHECKBOX style
,if(but(lParam))
,,;mac "MyMacro"
,,out "Started"
,else
,,;shutdown -6 0 "MyMacro"
,,out "Stopped"
,TO_EnableSelected hDlg iif(but(lParam) "4 5 -6 -7" "-4 -5 6 7") 0 ""
,SetDlgItemText hDlg wParam iif(but(lParam) "Stop" "Start")
Function Dialog2
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3 4 5 6 7"
str c3Sta e4 e5 e6 e7
if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 215 138 "Dialog"
;3 Button 0x54033003 0x0 156 114 48 14 "Start"
;4 Edit 0x54030080 0x200 8 18 96 14 ""
;5 Edit 0x54030080 0x200 8 40 96 14 ""
;6 Edit 0x5C030080 0x200 8 62 96 14 ""
;7 Edit 0x5C030080 0x200 10 82 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030501 "*" "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3 ;; start-stop button must have BS_PUSHLIKE and BS_AUTOCHECKBOX style
,if(but(lParam))
,,;mac "MyMacro"
,,out "Started"
,,TO_EnableSelected hDlg "4 5" 0 "6 7"
,else
,,;shutdown -6 0 "MyMacro"
,,out "Stopped"
,,TO_EnableSelected hDlg "6 7" 0 "4 5"
,SetDlgItemText hDlg wParam iif(but(lParam) "Stop" "Start")
,case IDOK
,case IDCANCEL
ret 1
Could also do the enabling in 1 line. Thought maybe hard to read.
,case 3 ;; start-stop button must have BS_PUSHLIKE and BS_AUTOCHECKBOX style
,if(but(lParam))
,,;mac "MyMacro"
,,out "Started"
,else
,,;shutdown -6 0 "MyMacro"
,,out "Stopped"
,TO_EnableSelected hDlg iif(but(lParam) "4 5 -6 -7" "-4 -5 6 7") 0 ""
,SetDlgItemText hDlg wParam iif(but(lParam) "Stop" "Start")