Jump to content

Help with Radio Button Array


HockeyFan
 Share

Recommended Posts

Hi!

Could someone help me determine why I'm receiving the following error message when I run my script. Here is the error message:

: ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

GUICtrlSetOnEvent($Radios[$dX], "CityNameSelectOKButtonEnable")

GUICtrlSetOnEvent(^ ERROR

Basically, I have a GUI created with a bunch of city names displayed in four colums. What I want to happen is, initally the "OK" button is disabled but once any radio button is selected, the "OK" button is then enabled.

Here is the associated code:

$CityState = "Akron, OH/akr:Albany, NY/alb:Albuquerque, NM/alb:Alexandria, VA/alx:Amherst, NY/amh:Anchorage, AK/anc:Atlanta, GA/atl:Austin, TX/aus:Bala Cynwyd, PA/bcy:Baltimore, MD/bal:Baton Rouge, LA/bat:Bentonville, AR/ben:Bethlehem, PA/bet:Billings, MT/bil:Bingham Farms, MI/bgf:Birmingham, AL/bir:Boston, MA/bos:Bridgewater, NJ/bri:Cedar Rapids, IA/cdr:Charlotte, NC/chr:Chesapeake, VA/che:Chicago, IL/chi:Cincinnati, OH/cin:Columbia, SC/col:Columbus, OH/col:Corpus Christi, TX/cor:Dallas, TX/dal:Decatur, IL/dec:Denver, CO/den:East Syracuse, NY/syr:Emeryville, CA/emv:Eugene, OR/eug:Evansville,IN/evn:Everett, WA/eve:Fargo, ND/far:Fort Lauderdale, FL/ftl:Fort Worth, TX/ftw:Fresno, CA/frs:Grand Rapids, MI/gra:Greenville, SC/gre:Harrisburg, PA/har:Honolulu, HI/hon:Houston, TX/hou:Huntsville, AL/hun:Independence, OH/ind:Indianapolis, IN/ind:(Editorial Ofc.) Indianapolis, IN/edi:Jackson, MS/jck:Jacksonville, FL/jac:Knoxville, TN/knx:Las Vegas, NV/las:Lexington, KY/lex:Little Rock, AR/ltr:Los Angeles, CA/los:Louisville, KY/lou:Lubbock, TX/lub:Maitland, FL/mtl:Manchester, NH/man:Manona, WI/man:McAllen, TX/mca:Melville, NY/mel:Memphis, TN/mem:Miami, FL/mia:Middletown, CT/mid:Midland, TX/mid:Minneapolis, MN/stl:Nashville, TN/nsh:New Orleans, LA/new:New York, NY/nyc:Oklahoma City, OK/okl:Omaha, NE/oma:Overland Park, KS/ovr:Pensacola, FL/pen:Phoenix, AZ/phx:Pittsburgh, PA/pit:Portland, OR/por:Portland, ME/por:Providence, RI/pro:Raleigh, NC/ral:Richland, WA/ric:Richmond, VA/ric:Rochester, NY/roc:Sacramento, CA/sac:Salisbury, MD/sal:Salt Lake City, UT/slc:San Antonio, TX/san:San Diego, CA/sad:San Jose, CA/saj:Santa Ana, CA/ana:Savannah, GA/svh:Seattle, WA/sea:Spokane, WA/spo:Springfield, MO/spr:St. Louis, MO/stl:Tampa, FL/tam:Tucson, AZ/tuc:Tulsa, OK/tul:Urbandale, IA/urb:Utica, NY/uti:Washington, DC/was:Wawatosa, WI/waw:White Plains, NY/whi:Wichita, KS/wic:Wilmington, DE/wil:Blank, XX/bla"

$CityArrayData = StringSplit($CityState, ":")
Local $Radios[$CityArrayData[0]]
Local $CityID[$CityArrayData[0]]

$CityNameGUI = GUICreate("", 775, 626, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))
;GUISetBkColor(0x000000); Black
$CityNameLabel1 = GUICtrlCreateLabel("Please select the city where your office is located:", 25, 8, 500, 25, $SS_CENTERIMAGE)
GUICtrlSetFont(-1, 12, 800, 0, "Arial")
GUICtrlSetColor(-1, 0x0000ff) ;Blue

$CityNameGroup1 = GUICtrlCreateGroup("", 24, 32, 725, 468)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;First Row
$aP = 50
For $aX = 1 To 26
    $Radios[$aX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$aX], 4), 50, $aP, 160, 17)
$CityID[$aX] = $CityArrayData[$aX]
;GUICtrlSetColor(-1, 0xff0000)   ; Red
    $aP += 16
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Second Row
$bP = 50
For $bX = 27 To 52
    $Radios[$bX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$bX], 4), 225, $bP, 160, 17)
$CityID[$bX] = $CityArrayData[$bX]
;GUICtrlSetColor(-1, 0xff0000)   ; Red
    $bP += 16
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Third Row
$cP = 50
For $cX = 53 To 78
    $Radios[$cX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$cX], 4), 400, $cP, 160, 17)
$CityID[$cX] = $CityArrayData[$cX]
;GUICtrlSetColor(-1, 0xff0000)   ; Red
    $cP += 16
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Fourth Row
$dP = 50
For $dX = 79 To 104
$Radios[$dX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$dX], 4), 575, $dP, 160, 17)
$CityID[$dX] = $CityArrayData[$dX]
;GUICtrlSetColor(-1, 0xff0000)   ; Red
    $dP += 16
Next

GUICtrlCreateGroup("", -99, -99, 1, 1)
$CityNameButton = GUICtrlCreateButton("OK", 325, 550, 115, 35, 0)
GUICtrlSetFont(-1, 12, 800, 0, "Arial")

GUICtrlSetState ($CityNameButton, $GUI_DISABLE)

GUICtrlSetOnEvent($Radios[$aX], "CityNameSelectOKButtonEnable")
GUICtrlSetOnEvent($Radios[$bX], "CityNameSelectOKButtonEnable")
GUICtrlSetOnEvent($Radios[$cX], "CityNameSelectOKButtonEnable")
GUICtrlSetOnEvent($Radios[$dX], "CityNameSelectOKButtonEnable")


Func CityNameSelectOKButtonEnable()
GUICtrlSetState ($CityNameButton, $GUI_ENABLE)
EndFunc

Any help would be greatly appriciated! :graduated:

Link to comment
Share on other sites

You are doing "For $dX = 79 To 104". On the last pass through that loop $dX = 104, then it gets incremented to 105 which causes the loop to exit. So after "For $dX = 79 To 104" is done, you have $dX = 105, which must be one more than the highest index in that array.

For $dX = 79 To 104
Next
ConsoleWrite("$dX = " & $dX & @LF)

:graduated:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You are doing "For $dX = 79 To 104". On the last pass through that loop $dX = 104, then it gets incremented to 105 which causes the loop to exit. So after "For $dX = 79 To 104" is done, you have $dX = 105, which must be one more than the highest index in that array.

For $dX = 79 To 104
Next
ConsoleWrite("$dX = " & $dX & @LF)

:(

PsaltyDS,

Thanks for the reply and I get what your stating. Problem is, I'm not sure how to resolve it. :D What I can't wrap my head around is why I'm now getting this error message. All I added was the code to disable the OK button and set events to enable the OK button once one of the radio buttons was clicked...unless I got have that code incorrect. Posted Image

GUICtrlSetOnEvent($Radios[$aX], "CityNameSelectOKButtonEnable")
GUICtrlSetOnEvent($Radios[$bX], "CityNameSelectOKButtonEnable")
GUICtrlSetOnEvent($Radios[$cX], "CityNameSelectOKButtonEnable")
GUICtrlSetOnEvent($Radios[$dX], "CityNameSelectOKButtonEnable")

What do I need to do to deal with the $dX = 105 event?:graduated:

Link to comment
Share on other sites

For $dX = 79 To 104-1

Next

??

what is stopping you from doing that? how big are your array sizes?

Link to comment
Share on other sites

The problem is not in the loop itself; that works correctly and exits when it is done with $dX = 105.

AFTER the loop is done, you go back and reuse that variable in: GUICtrlSetOnEvent($Radios[$dX], "CityNameSelectOKButtonEnable")

Where the value of 105 is too big for the array. If you thought $dX would still have the last index from the array (104) then you could have just done this instead of hoping the value in $dX was right:

GUICtrlSetOnEvent($Radios[Ubound($Radios) - 1], "CityNameSelectOKButtonEnable")

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The problem is not in the loop itself; that works correctly and exits when it is done with $dX = 105.

AFTER the loop is done, you go back and reuse that variable in: GUICtrlSetOnEvent($Radios[$dX], "CityNameSelectOKButtonEnable")

Where the value of 105 is too big for the array. If you thought $dX would still have the last index from the array (104) then you could have just done this instead of hoping the value in $dX was right:

GUICtrlSetOnEvent($Radios[Ubound($Radios) - 1], "CityNameSelectOKButtonEnable")

:(

PsaltyDS,

The array does not change, so I encluded your suggestion. Ran script...it executes without generating the error, YEA!...but the OK button does not become enabled once one of the array radio buttons in selected. Any ideas as to why? :graduated:

Link to comment
Share on other sites

Here is the working script...

; Script Start

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <StaticConstants.au3>

#include <GUIConstants.au3>

#include <WindowsConstants.au3>

#include <GUIConstantsEx.au3>

#include <Constants.au3>

#Include <GuiEdit.au3>

#include <GuiButton.au3>

#include <Array.au3>

#include <File.au3>

Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled

Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info

AutoItSetOption("TrayIconHide", 0) ;0 = show icon (default), 1 = hide icon.

Break(0) ;1 = Break is enabled (user can quit) (default), 0 = Break is disabled (user cannot quit).

WinMinimizeAll()

;--------------------------------------------------------------------------------------------------------

$CityState = "Akron, OH/akr:Albany, NY/alb:Albuquerque, NM/alb:Alexandria, VA/alx:Amherst, NY/amh:Anchorage, AK/anc:Atlanta, GA/atl:Austin, TX/aus:Bala Cynwyd, PA/bcy:Baltimore, MD/bal:Baton Rouge, LA/bat:Bentonville, AR/ben:Bethlehem, PA/bet:Billings, MT/bil:Bingham Farms, MI/bgf:Birmingham, AL/bir:Boston, MA/bos:Bridgewater, NJ/bri:Cedar Rapids, IA/cdr:Charlotte, NC/chr:Chesapeake, VA/che:Chicago, IL/chi:Cincinnati, OH/cin:Columbia, SC/col:Columbus, OH/col:Corpus Christi, TX/cor:Dallas, TX/dal:Decatur, IL/dec:Denver, CO/den:East Syracuse, NY/syr:Emeryville, CA/emv:Eugene, OR/eug:Evansville,IN/evn:Everett, WA/eve:Fargo, ND/far:Fort Lauderdale, FL/ftl:Fort Worth, TX/ftw:Fresno, CA/frs:Grand Rapids, MI/gra:Greenville, SC/gre:Harrisburg, PA/har:Honolulu, HI/hon:Houston, TX/hou:Huntsville, AL/hun:Independence, OH/ind:Indianapolis, IN/ind:(Editorial Ofc.) Indianapolis, IN/edi:Jackson, MS/jck:Jacksonville, FL/jac:Knoxville, TN/knx:Las Vegas, NV/las:Lexington, KY/lex:Little Rock, AR/ltr:Los Angeles, CA/los:Louisville, KY/lou:Lubbock, TX/lub:Maitland, FL/mtl:Manchester, NH/man:Manona, WI/man:McAllen, TX/mca:Melville, NY/mel:Memphis, TN/mem:Miami, FL/mia:Middletown, CT/mid:Midland, TX/mid:Minneapolis, MN/stl:Nashville, TN/nsh:New Orleans, LA/new:New York, NY/nyc:Oklahoma City, OK/okl:Omaha, NE/oma:Overland Park, KS/ovr:Pensacola, FL/pen:Phoenix, AZ/phx:Pittsburgh, PA/pit:Portland, OR/por:Portland, ME/por:Providence, RI/pro:Raleigh, NC/ral:Richland, WA/ric:Richmond, VA/ric:Rochester, NY/roc:Sacramento, CA/sac:Salisbury, MD/sal:Salt Lake City, UT/slc:San Antonio, TX/san:San Diego, CA/sad:San Jose, CA/saj:Santa Ana, CA/ana:Savannah, GA/svh:Seattle, WA/sea:Spokane, WA/spo:Springfield, MO/spr:St. Louis, MO/stl:Tampa, FL/tam:Tucson, AZ/tuc:Tulsa, OK/tul:Urbandale, IA/urb:Utica, NY/uti:Washington, DC/was:Wawatosa, WI/waw:White Plains, NY/whi:Wichita, KS/wic:Wilmington, DE/wil:Blank, XX/bla"

$CityArrayData = StringSplit($CityState, ":")

Local $Radios[$CityArrayData[0]]

Local $CityID[$CityArrayData[0]]

$CityNameGUI = GUICreate("", 775, 626, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))

;GUISetBkColor(0x000000); Black

$CityNameLabel1 = GUICtrlCreateLabel("Please select the city where your office is located:", 25, 8, 500, 25, $SS_CENTERIMAGE)

GUICtrlSetFont(-1, 12, 800, 0, "Arial")

GUICtrlSetColor(-1, 0x0000ff) ;Blue

;GUICtrlSetColor(-1, 0xf8f8ff) ;Ghost White

$CityNameGroup1 = GUICtrlCreateGroup("", 24, 32, 725, 468)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;First Row

$aP = 50

For $aX = 1 To 26

$Radios[$aX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$aX], 4), 50, $aP, 160, 17)

$CityID[$aX] = $CityArrayData[$aX]

;GUICtrlSetColor(-1, 0xff0000) ; Red

$aP += 16

Next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Second Row

$bP = 50

For $bX = 27 To 52

$Radios[$bX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$bX], 4), 225, $bP, 160, 17)

$CityID[$bX] = $CityArrayData[$bX]

;GUICtrlSetColor(-1, 0xff0000) ; Red

$bP += 16

Next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Third Row

$cP = 50

For $cX = 53 To 78

$Radios[$cX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$cX], 4), 400, $cP, 160, 17)

$CityID[$cX] = $CityArrayData[$cX]

;GUICtrlSetColor(-1, 0xff0000) ; Red

$cP += 16

Next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Fourth Row

$dP = 50

For $dX = 79 To 104

$Radios[$dX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$dX], 4), 575, $dP, 160, 17)

$CityID[$dX] = $CityArrayData[$dX]

;GUICtrlSetColor(-1, 0xff0000) ; Red

$dP += 16

Next

;ConsoleWrite("$dX = " & $dX & @LF)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$CityNameButton = GUICtrlCreateButton("OK", 325, 550, 115, 35, 0)

GUICtrlSetFont(-1, 12, 800, 0, "Arial")

GUICtrlSetState ($CityNameButton, $GUI_DISABLE)

GUISetState(@SW_SHOW, $CityNameGUI)

GUICtrlSetOnEvent($CityNameButton, "CityNameOKButton")

;GUICtrlSetOnEvent($Radios[ubound($Radios) - 1], "CityNameSelectOKButtonEnable")

;GUICtrlSetOnEvent($Radios[$aX], "CityNameSelectOKButtonEnable")

;GUICtrlSetOnEvent($Radios[$bX], "CityNameSelectOKButtonEnable")

;GUICtrlSetOnEvent($Radios[$cX], "CityNameSelectOKButtonEnable")

;GUICtrlSetOnEvent($Radios[$dX], "CityNameSelectOKButtonEnable")

GUICtrlSetOnEvent($Radios[1], "CityNameSelectOKButtonEnable")

While 1

Sleep(400) ; Idle around

WEnd

Exit

Func CityNameOKButton()

For $x = 1 To UBound($CityArrayData) - 2

If BitAND(GUICtrlRead($Radios[$x]), $GUI_CHECKED) = $GUI_CHECKED Then

$SelectedCity = GUICtrlRead($Radios[$x], 1)

$UserCityName = $SelectedCity

$UserCityID = StringRight($CityID[$x], 3)

$UserCityIDCAPS = StringUpper ($UserCityID)

$UserStateID = StringRight($SelectedCity, 2)

$UserStateIDCAPS = StringUpper ($UserStateID)

EndIf

Next

GUIDelete($CityNameGUI)

Exit

EndFunc

Func CityNameSelectOKButtonEnable()

GUICtrlSetState ($CityNameButton, $GUI_ENABLE)

EndFunc

Link to comment
Share on other sites

Here are a few tweaks to consider (not in code tags because they are apparently broken right now):

#include <GuiConstantsEx.au3>

#include <WindowsConstants.au3>

#include <StaticConstants.au3>

Opt("GuiOnEventMode", 1)

$CityState = "Akron, OH/akr:Albany, NY/alb:Albuquerque, NM/alb:Alexandria, VA/alx:Amherst, NY/amh:Anchorage, " & _

"AK/anc:Atlanta, GA/atl:Austin, TX/aus:Bala Cynwyd, PA/bcy:Baltimore, MD/bal:Baton Rouge, LA/bat:Bentonville, " & _

"AR/ben:Bethlehem, PA/bet:Billings, MT/bil:Bingham Farms, MI/bgf:Birmingham, AL/bir:Boston, MA/bos:Bridgewater, " & _

"NJ/bri:Cedar Rapids, IA/cdr:Charlotte, NC/chr:Chesapeake, VA/che:Chicago, IL/chi:Cincinnati, OH/cin:Columbia, " & _

"SC/col:Columbus, OH/col:Corpus Christi, TX/cor:Dallas, TX/dal:Decatur, IL/dec:Denver, CO/den:East Syracuse, " & _

"NY/syr:Emeryville, CA/emv:Eugene, OR/eug:Evansville,IN/evn:Everett, WA/eve:Fargo, ND/far:Fort Lauderdale, " & _

"FL/ftl:Fort Worth, TX/ftw:Fresno, CA/frs:Grand Rapids, MI/gra:Greenville, SC/gre:Harrisburg, PA/har:Honolulu, " & _

"HI/hon:Houston, TX/hou:Huntsville, AL/hun:Independence, OH/ind:Indianapolis, IN/ind:(Editorial Ofc.) Indianapolis, " & _

"IN/edi:Jackson, MS/jck:Jacksonville, FL/jac:Knoxville, TN/knx:Las Vegas, NV/las:Lexington, KY/lex:Little Rock, " & _

"AR/ltr:Los Angeles, CA/los:Louisville, KY/lou:Lubbock, TX/lub:Maitland, FL/mtl:Manchester, NH/man:Manona, " & _

"WI/man:McAllen, TX/mca:Melville, NY/mel:Memphis, TN/mem:Miami, FL/mia:Middletown, CT/mid:Midland, TX/mid:Minneapolis, " & _

"MN/stl:Nashville, TN/nsh:New Orleans, LA/new:New York, NY/nyc:Oklahoma City, OK/okl:Omaha, NE/oma:Overland Park, " & _

"KS/ovr:Pensacola, FL/pen:Phoenix, AZ/phx:Pittsburgh, PA/pit:Portland, OR/por:Portland, ME/por:Providence, " & _

"RI/pro:Raleigh, NC/ral:Richland, WA/ric:Richmond, VA/ric:Rochester, NY/roc:Sacramento, CA/sac:Salisbury, " & _

"MD/sal:Salt Lake City, UT/slc:San Antonio, TX/san:San Diego, CA/sad:San Jose, CA/saj:Santa Ana, CA/ana:Savannah, " & _

"GA/svh:Seattle, WA/sea:Spokane, WA/spo:Springfield, MO/spr:St. Louis, MO/stl:Tampa, FL/tam:Tucson, AZ/tuc:Tulsa, " & _

"OK/tul:Urbandale, IA/urb:Utica, NY/uti:Washington, DC/was:Wawatosa, WI/waw:White Plains, NY/whi:Wichita, " & _

"KS/wic:Wilmington, DE/wil:Blank, XX/bla"

$CityArrayData = StringSplit($CityState, ":")

Global $Radios[$CityArrayData[0] + 1] = [$CityArrayData[0]] ; [0] = count

Global $CityID[$CityArrayData[0] + 1] = [$CityArrayData[0]] ; [0] = count

$CityNameGUI = GUICreate("", 775, 626)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

$CityNameLabel1 = GUICtrlCreateLabel("Please select the city where your office is located:", 25, 8, 500, 25, $SS_CENTERIMAGE)

GUICtrlSetFont(-1, 12, 800, 0, "Arial")

GUICtrlSetColor(-1, 0x0000ff) ;Blue

$CityNameGroup1 = GUICtrlCreateGroup("", 24, 32, 725, 468)

Global $iX = 50 ; Starting X-pos

Global $iY = 50 ; Starting Y-pos

For $aX = 1 To $Radios[0]

$Radios[$aX] = GUICtrlCreateRadio(StringTrimRight($CityArrayData[$aX], 4), $iX, $iY, 160, 17)

GUICtrlSetOnEvent(-1, "CityNameSelectOKButtonEnable")

$CityID[$aX] = $CityArrayData[$aX]

$iY += 16

If Mod($aX, 27) = 0 Then

; Start new column (26 items per column)

$iY = 50

$iX += 175

EndIf

Next

GUICtrlCreateGroup("", -99, -99, 1, 1)

$CityNameButton = GUICtrlCreateButton("OK", 330, 550, 115, 35)

GUICtrlSetOnEvent(-1, "_ButtonHit")

GUICtrlSetState($CityNameButton, $GUI_DISABLE)

GUISetState()

While 1

Sleep(10)

WEnd

Func CityNameSelectOKButtonEnable()

ConsoleWrite("Debug: Clicked a radio: ID = " & @GUI_CtrlId & "; Text = " & ControlGetText(@GUI_WinHandle, "", @GUI_CtrlId) & @LF)

GUICtrlSetState($CityNameButton, $GUI_ENABLE)

EndFunc ;==>CityNameSelectOKButtonEnable

Func _Quit()

Exit

EndFunc ;==>_Quit

Func _ButtonHit()

For $n = 1 To $Radios[0]

If ControlCommand($CityNameGUI, "", $Radios[$n], "IsChecked") Then

MsgBox(64, "OK", "ID: " & $Radios[$n] & "; Text: " & ControlGetText($CityNameGUI, "", $Radios[$n]))

ExitLoop

EndIf

Next

GUICtrlSetState($CityNameButton, $GUI_DISABLE)

EndFunc ;==>_ButtonHit

Note all the controls are created and assigned the event handler in one pass through a single loop.

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...