Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pass variables to functions as arguments
#7
make these changes

Function Main
Code:
Copy      Help
;;text input here
str controls = "9"
str e9
str s
if(!ShowDialog("Function9" &Function9 &controls)) ret
type MyVARIABLES str'idcode
MyVARIABLES x; x.idcode=e9

str controls2 = "3"
str c3Sta
if(!ShowDialog("Function7" &Function7 &controls2 0 0 0 0 &x)) ret

Function Function7
Code:
Copy      Help
;dialog start and stop
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80AC4 0x108 0 0 63 46 "CB"
;3 Button 0x54013003 0x0 6 6 48 14 "Start"
;1 Button 0x54030001 0x0 6 24 48 14 "Back"
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "" "" "" ""

ret
;messages
MyVARIABLES& x=+DT_GetParam(hDlg)
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,if(but(lParam)) ;;checked
,,mac "Macro8" "" x.idcode
,,_s="Stop"
,else ;;unchecked
,,shutdown -6 0 "Macro8"
,,_s="Start"
,_s.setwintext(lParam)
,case IDOK
,mac "UI"
,shutdown -6 0 "Macro8"
,case IDCANCEL
ret 1

Function Function9
Code:
Copy      Help
;;form input
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x8 0 0 400 200 "Test"
;3 Static 0x54000201 0x0 26 20 60 15 "ID"
;9 Edit 0x54030080 0x200 100 20 110 15 ""
;20 Static 0x54000011 0x20000 222 18 1 143 ""
;21 Static 0x54000010 0x20000 212 90 11 1 ""
;1 Button 0x54030001 0x0 152 176 48 14 "OK"
;2 Button 0x54030000 0x0 216 176 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "" "" "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

convert Macro8 to a function
Function Macro8
Code:
Copy      Help
;;out text input from main
function str's
rep 
,0.2
,out s

create a folder named Main
place all these functions inside the folder then make exe of folder

Question?? The back button in Function7 dialog Is it suppose to open Function9 dialog?


Messages In This Thread
RE: Pass variables to functions as arguments - by Kevin - 05-28-2021, 04:13 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)