Posts: 82
Threads: 31
Joined: Oct 2007
I've searched through the help file and the forum and can't quite find what I'm looking for so apologies if this has been addressed. I know how to create a dialog with check boxes and have actions carried out based on which boxes are checked. But I'm having difficulty simply carrying out an action when say "This Button" is pushed. How can I set my dialog to carry out different functions based on the button that's pushed. Maybe a goto command?
Thanks
Posts: 12,095
Threads: 142
Joined: Dec 2002
When the action/function should run? When dialog is alive, or after closing it with the button?
Posts: 82
Threads: 31
Joined: Oct 2007
The custom dialog opens with let's say 5 buttons I created with different labels for each. The user clicks say "Activate" button. I then want it to use a "goto" command and goto that label in the code.
Posts: 12,095
Threads: 142
Joined: Dec 2002
3 examples. Choose which is better for you.
Function
dlg_button1
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("dlg_button1" &dlg_button1)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 18 16 48 14 "Button3"
;4 Button 0x54032000 0x0 18 36 48 14 "Button4"
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,out "Button3"
,
,case 4
,out "Button4"
,
,case IDOK
,out "OK"
,
,case IDCANCEL
ret 1
;3 and 4 are button id, as specified in text in BEGIN DIALOG ... END DIALOG
Function dlg_button2
\Dialog_Editor
sel ShowDialog("dlg_button2" 0)
,case 1
,out "OK"
,
,case 3
,out "Button3"
,
,case 4
,out "Button4"
,
,case else
,ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 18 16 48 14 "Button3"
;4 Button 0x54032000 0x0 18 36 48 14 "Button4"
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "" "" ""
Function dlg_button3
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
sel ShowDialog("dlg_button3" &dlg_button3)
,case 1
,out "OK"
,
,case 3
,out "Button3"
,
,case 4
,out "Button4"
,
,case else
,ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 18 16 48 14 "Button3"
;4 Button 0x54032000 0x0 18 36 48 14 "Button4"
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case [3,4]
,DT_Ok hDlg wParam
,
,case IDOK
,case IDCANCEL
ret 1
;3 and 4 are button id, as specified in text in BEGIN DIALOG ... END DIALOG
Posts: 82
Threads: 31
Joined: Oct 2007
Helpful as always! Thanks so much!
Jason