Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm a dialog VIRGIN, help!
#5
Example for "simple" dialog.

Function Dialog191
Code:
Copy      Help
\Dialog_Editor

;run "notepad" ;;enable these disabled green lines if really need Notepad

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54032000 0x0 8 8 48 14 "Hello"
;4 Button 0x54032000 0x0 8 28 48 14 "Goodbye"
;END DIALOG
;DIALOG EDITOR: "" 0x2040302 "*" "" "" ""

int button=ShowDialog(dd 0 0)
sel button
,case 3
,out "Hello"
,;act "Notepad"; key "Hello"
,;...
,
,case 4
,out "Goodbye"
,;act "Notepad"; key "Goodbye"
,;...

Example for "smart" dialog. The button closes the dialog.

Function Dialog192
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54032000 0x0 8 8 48 14 "Hello"
;4 Button 0x54032000 0x0 8 28 48 14 "Goodbye"
;END DIALOG
;DIALOG EDITOR: "" 0 "*" "" "" ""

int button=ShowDialog(dd &sub.DlgProc 0)
;out button
sel button
,case 3
,out "Hello"
,;...
,
,case 4
,out "Goodbye"
,;...


#sub DlgProc
function# hDlg message wParam lParam

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

Example for "smart" dialog. The button launches another macro and does not close the dialog.

Function Dialog193
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54032000 0x0 8 8 48 14 "Hello"
;4 Button 0x54032000 0x0 8 28 48 14 "Goodbye"
;END DIALOG
;DIALOG EDITOR: "" 0 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,mac "Hello macro"
,
,case 4
,mac "Goodbye macro"
,
,case IDOK
,case IDCANCEL
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)