SkellySoul Posted May 1, 2014 Share Posted May 1, 2014 I have a GUI that creates a control which is an array and was wondering how I can do something like this While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE _Exit() Case $Data[1] To $Data[UBound($Data_Array) -1] $Result = Case MsgBox(0 , "Test", "You clicked on Data " & $Result) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Jfish Posted May 1, 2014 Share Posted May 1, 2014 (edited) I don't see any control that would be displaying the data in your array on which you could click to trigger your message. I think you want to implement a listview in the GUI and then have the case within the while statement be listening for the selected item in the listview, reading its value, and then displaying the msgbox. It would also help if you posted the rest of your code with the GUI Edited May 1, 2014 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
SkellySoul Posted May 1, 2014 Author Share Posted May 1, 2014 Oops, I figured it out. While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE _Exit() Case Else For $i = 1 To UBound($Data_Array) -1 If $Msg = $Data[$i] Then MsgBox(0 , "",GUICtrlRead($Data[$i])) Next EndSwitch WEnd Link to comment Share on other sites More sharing options...
BrewManNH Posted May 1, 2014 Share Posted May 1, 2014 MsgBox(0 , "Test", "You clicked on Data " & $msg) ; <<<<<<<<<<< $msg already tells you which control was actioned. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
SkellySoul Posted May 1, 2014 Author Share Posted May 1, 2014 (edited) This works for primary down Case Else For $i = 1 To UBound($Card_Array) -1 $Cursor = GUIGetCursorInfo($GUI) If $Msg = $Data[$i] And $Cursor[2] = 1 Then MsgBox(0 , $Msg ,GUICtrlRead($Data[$i])) Next but this doesn't work for secondary down Case Else For $i = 1 To UBound($Card_Array) -1 $Cursor = GUIGetCursorInfo($GUI) If $Msg = $Data[$i] And $Cursor[3] = 1 Then MsgBox(0 , $Msg ,GUICtrlRead($Data[$i])) Next I think it might be releasing the cursor to fast or something but primary works...weird , mhm Edited May 1, 2014 by SkellySoul Link to comment Share on other sites More sharing options...
BrewManNH Posted May 1, 2014 Share Posted May 1, 2014 What exactly are you attempting? Because that code isn't written to detect a right click. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
SkellySoul Posted May 1, 2014 Author Share Posted May 1, 2014 (edited) I want to detect if I am left clicking or right clicking a label and then it will either up the label +1 or -1 depending on the click. And I guess that explains why the primary was working lol Edited May 1, 2014 by SkellySoul Link to comment Share on other sites More sharing options...
BrewManNH Posted May 1, 2014 Share Posted May 1, 2014 Check out the link in my signature to GUIRegisterMsg demo, that might get you pointed in the right direction. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
SkellySoul Posted May 1, 2014 Author Share Posted May 1, 2014 Thanks for the help, I got it 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