Guest zitto Posted January 21, 2005 Share Posted January 21, 2005 (edited) Hello,I'm facing a little problem, hope you can help me. In my script, I have 60 radio buttons corresponding to 60 customers.I have an array containing names of customers.I want to test with a For condition which radio button is selected and then display the name of the customer, I mean if $radio0 is checked, display the value of $Array[0]Problem is that here under I don't succeed to read the value of $radio"i" assuming i is a variable going from 0 to 59.I don't succeed to make $radio"1" becoming the radio control $radio1Can you help me ? Do you see what I mean ? Example : syntax of bold characters is false, I can't find how I can do thatDim $1Dim $radioDim $Array[60]$radio0 = GUICtrlCreateRadio ("XXX", 10, 10, 50, 20)$radio1 = GUICtrlCreateRadio ("YYY", 10, 30, 50, 20)$radio2 = GUICtrlCreateRadio ("ZZZ", 10, 50, 50, 20)[...]$Array[0] = "XXX" $Array[1] = "YYY"$Array[2] = "ZZZ"[...]$Button= GUICtrlCreateButton ( "Button", 70, 360 ,70, 20)Do $msg = GUIGetMsg() For $i = 0 to 59 If GUICtrlRead("$radio" & $i) = $GUI_CHECKED Then $Customer = $Array[$i] EndIf Next if $msg = $Button Then msgbox(0,"test", $Customer) EndIfUntil $msg = $GUI_EVENT_CLOSE Edited January 21, 2005 by zitto Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 21, 2005 Administrators Share Posted January 21, 2005 Put your control ids in a similar array: Dim $Radio[60] $Radio[0] = GUICtrlCreateRadio ("XXX", 10, 10, 50, 20) $Radio[1] = GUICtrlCreateRadio ("YYY", 10, 30, 50, 20) Then when you loop through Radio[0] to Radio[59] and find one that is selected you automatically know which customer it corresponds to. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted January 21, 2005 Share Posted January 21, 2005 Or use a 2 dimensional array... Dim $aRadios[60][2] ; Populate array somehow $aRadios[0][0] = "XXX" $aRadios[0][1] = "YYY" ... ; Write an algorithm to place controls at intervals Local $x = 10, $y = 10 For $i = 0 To UBound($aRadios)-1 $aRadios[$i][1] = GUICtrlCreateRadio($aRadios[$i][0], $x, $y+($i*20), 50, 20) Next That would create all 60 radio's in a top to bottom fashion. If you wanted multiple columns, then it would require more work, but is still a lot less code than doing it all by hand. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now