09-23-2008, 09:58 PM
Ok I have this so far;
Function Option_Array_Dialog
Macro
I have not found a way to place this in my dialog and make it work but it does work as a stand-alone macro.
I am wondering if I am wasting my time trying to learn arrays especially in this instance. I think that if I had more than three options to chouse from an array would be the right place to hold the information. I am wondering if there is an easier way to make an array for this and I will keep trying if just to find out the best way to do it.
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 135 "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"
;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 IDOK
,case IDCANCEL
ret 1
Macro
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
if(a[0] = 16)
,mes("Option 1 was selected")
if(a[1] = 16)
,mes("Option 2 was selected")
if(a[2] = 16)
,mes("Option 3 was selected")
I have not found a way to place this in my dialog and make it work but it does work as a stand-alone macro.
I am wondering if I am wasting my time trying to learn arrays especially in this instance. I think that if I had more than three options to chouse from an array would be the right place to hold the information. I am wondering if there is an easier way to make an array for this and I will keep trying if just to find out the best way to do it.