Sign in to follow this  
Followers 0
SkellySoul

GUI Case Loop

9 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites

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 Gude
How 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

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by SkellySoul

Share this post


Link to post
Share on other sites

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 Gude
How 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

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by SkellySoul

Share this post


Link to post
Share on other sites

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 Gude
How 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

Share this post


Link to post
Share on other sites

Thanks for the help, I got it  :thumbsup:

Share this post


Link to post
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
Sign in to follow this  
Followers 0