Damein Posted February 9, 2014 Share Posted February 9, 2014 So I have an array of buttons, that might reach in the hundreds and I need a way to track when a specific one is pressed. Currently, I have it setup like this Func _Floor1() GuiCtrlSetState($Floor1Image, $GUI_SHOW) For $i = 1 To 8 $RoomStatus[$i] = IniRead(@ScriptDir & "\Data\Floor1Rooms.ini", $i, "Status", "Not Found") $RoomImage[$i] = @ScriptDir & "\Images\" & $RoomStatus[$i] & ".bmp" $X = IniRead(@ScriptDir & "\Data\Floor1Rooms.ini", $i, "X", "Not Found") $Y = IniRead(@ScriptDir & "\Data\Floor1Rooms.ini", $i, "Y", "Not Found") GuiCtrlCreatePic($RoomImage[$i],$X,$Y,65,65) GuiCtrlSetState(-1, $GUI_SHOW) $CheckMaintenance = IniRead(@ScriptDir & "\Data\Floor1Rooms.ini", $i, "Maintenance", "Not Found") If $CheckMaintenance = 1 Then $MaintenanceButtonIssue[$i] = GuiCtrlCreateButton("Test",$X+12, $Y+12,40,40,$BS_BITMAP) GUICtrlSetImage(-1, $MaintenanceImage) GUICtrlSetOnEvent($MaintenanceButtonIssue[$i], "_Test") GuiCtrlSetState($MaintenanceButtonIssue[$i], $GUI_ONTOP) EndIf Next EndFunc Func _Test() For $i = 1 To 8 $MaintenanceProblem[$i] = IniRead(@ScriptDir & "\Data\Service Recovery.ini", $i, "Problem", "Not Found") If $MaintenanceProblem[$i] > "" Then MsgBox(0, "Test", $MaintenanceProblem[$i]) ExitLoop EndIf Next EndFunc But obviously it will stop at the first sign of MaintenanceProblem[$i] having a value. I don't wan't it to do that, I need it to track which button was pressed from the array $MaintenanceButtonIssue[$i] set in the Floor1 function. Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
JohnOne Posted February 9, 2014 Share Posted February 9, 2014 I'm not sure what your script is doing, or of the question you're asking. Best guess -> @GUI_CtrlId AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Valuater Posted February 9, 2014 Share Posted February 9, 2014 You can use this to get the last button clicked @GUI_CtrlId Last click GUI Control identifier. Only valid in an event Function. See the GUICtrlSetOnEvent function 8) Link to comment Share on other sites More sharing options...
Damein Posted February 9, 2014 Author Share Posted February 9, 2014 Okay, when using that I can get the ID of the button, but how do I use that in conjunction with an Inifile that has sections like this [1] Problem=Damaged [2] Problem= [3] Problem=Broken Now what is happening the buttons are being created each time a value is assigned to Problem in the Inifile. When I click that button, I need to be able to pull that Problem's value out of the Inifile, and just that one. Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
JohnOne Posted February 9, 2014 Share Posted February 9, 2014 Get the text of the button, or it's corresponding label or group, or something else. Upon start write the controlID to the inifile etc... There are many ways. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Damein Posted February 9, 2014 Author Share Posted February 9, 2014 Aaaah, I wasn't thinking about it that way. Got it, I assigned each button the current $i value when its created and then used $ID = @GUI_CtrlId $Info = GuiCtrlRead($ID) $ShowProblem = IniRead(@ScriptDir & "\Data\Service Recovery.ini", $Info, "Problem", "Not Found") MsgBox(0, "Test", $ShowProblem) Thanks for the help! Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
JohnOne Posted February 9, 2014 Share Posted February 9, 2014 Ace. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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