09-23-2008, 11:20 PM
Okay...so here is your example better utilizing arrays...
Function Option_Array_Dialog
Function Option_Array_Dialog
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3 4 5"
str o3Opt o4Opt o5Opt
if(!ShowDialog("Option_Array_Dialog" &Option_Array_Dialog &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 134 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032009 0x0 10 8 48 12 "Option 1"
;4 Button 0x54002009 0x0 10 26 48 12 "Option 2"
;5 Button 0x54002009 0x0 10 44 48 13 "Option 3"
;6 Button 0x54032000 0x0 112 8 76 32 "Check which Option"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6
,int i
,Acc Option1=acc("Option 1" "RADIOBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int Opt1=Option1.State()
,Acc Option2=acc("Option 2" "RADIOBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int Opt2=Option2.State()
,Acc Option3=acc("Option 3" "RADIOBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int Opt3=Option3.State()
,ARRAY(int) a.create(3) ;;create array of integers
,a[0]=Opt1 ;;set option 0 element
,a[1]=Opt2 ;;set option 1 element
,a[2]=Opt3 ;;set option 2 element
,int el=a[0] ;;get element
,;;This is what makes arrays cool too!!
,for(i 0 a.len)
,,if a[i] = 1048592
,,,_s.format("Option %i was selected" i+1)
,,,mes _s
,,,ret
,if(a[0] and a[1] and a[2]=1048576)
,,mes "No options were selected" "Please Pick Something" "!"
,case IDOK
,case IDCANCEL
ret 1