probedrone Posted August 31, 2006 Share Posted August 31, 2006 Hi, Ive ran into some problems working with 2d arrays... Im trying to substitute a Class type with a 2d array, so each element of the array can contain 2 values: Dim array[30][2] I want the first part of each element to contain a GUI checkbox, and the 2nd part to contain TRUE if it is checked and FALSE if it is unchecked...How would I go about doing this? Also how would I iterate through this kind of array if I only want to look at the first part of each element? "For $i[0] in $array" doesnt seem to work Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2006 Developers Share Posted August 31, 2006 This will fill the array with the state of the checkboxes assuming Contol handles are loaded in the first value For $x = 0 to Ubound($array)-1 GuiRead($array[$x][1]) = GuiRead($array[$x][0]) Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted August 31, 2006 Share Posted August 31, 2006 kinda like... Dim $array[30][2] For $x = 1 to UBound($array) -1 $array[$x][1] = GUICtrlCreateCheckbox(.....) Next ; OR.... $array[1][1] = GUICtrlCreateCheckbox(.....) $array[2][1] = GUICtrlCreateCheckbox(.....) $array[3][1] = GUICtrlCreateCheckbox(.....) $array[4][1] = GUICtrlCreateCheckbox(.....) ;......... ; to check for true or false For $i = 1 to UBound($array) - 1 If BitAnd(GUICtrlRead($array[$i][1]),$GUI_CHECKED) = $GUI_CHECKED Then $array[$i][2] = "True" Else $array[$i][2] = "False" EndIf Next 8) Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2006 Developers Share Posted August 31, 2006 Dim $array[30][2] For $x = 1 to UBound($array) -1 $array[$x][1] = GUICtrlCreateCheckbox(.....) Next ; OR.... $array[1][1] = GUICtrlCreateCheckbox(.....) $array[2][1] = GUICtrlCreateCheckbox(.....) $array[3][1] = GUICtrlCreateCheckbox(.....) $array[4][1] = GUICtrlCreateCheckbox(.....) ;......... ; to check for true or false For $i = 1 to UBound($array) - 1 If BitAnd(GUICtrlRead($array[$i][1]),$GUI_CHECKED) = $GUI_CHECKED Then $array[$i][2] = "True" Else $array[$i][2] = "False" EndIf Next 8) Need to use [0] and [1] ....[2] will give an error when running this .. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted August 31, 2006 Share Posted August 31, 2006 (edited) Need to use [0] and [1] ....[2] will give an error when running this .. Awh... you caught it just before i did or... use Dim $array[30][3] and it will work ok 8) Edited August 31, 2006 by Valuater 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