03-24-2015, 05:26 AM
To pass value to smart dialog, I often use 2 ways:
Method 1: using global variable
Function tempf12_with_global_var
Method 2: use v param in sub function
Function tempf12_with_v_param
In your case, by trial and error I will do like this:
Function tempf12
Method 1: using global variable
Function tempf12_with_global_var
;\Dialog_Editor
function int'i
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 208 66 "Dialog"
;3 Static 0x54000000 0x0 74 18 48 12 "Text"
;1 Button 0x54030001 0x4 86 44 48 14 "OK"
;2 Button 0x54030000 0x4 154 44 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""
int+ j=i
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,_s=F"{j}"
,_s.setwintext(id(3 hDlg))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1Function tempf12_with_v_param
;\Dialog_Editor
function int'i
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 208 66 "Dialog"
;3 Static 0x54000000 0x0 74 18 48 12 "Text"
;1 Button 0x54030001 0x4 86 44 48 14 "OK"
;2 Button 0x54030000 0x4 154 44 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,_s=F"{i}"
,_s.setwintext(id(3 hDlg))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1In your case, by trial and error I will do like this:
Function tempf12
;\Dialog_Editor
function int'i
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 208 66 "Dialog"
;3 Static 0x54000000 0x0 74 18 48 12 "Text"
;1 Button 0x54030001 0x4 86 44 48 14 "OK"
;2 Button 0x54030000 0x4 154 44 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""
int- j
j=i
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
int- j
sel message
,case WM_INITDIALOG
,_s=F"{j}"
,_s.setwintext(id(3 hDlg))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1