Sign in to follow this  
Followers 0
rosaz

GetMsg for close GUI, or to set constant

2 posts in this topic

I am brand-new to GUI's, and I know there must be an answer to this somewhere on this forum but I can't find it! What I want to do is create a GUI with 5 radio buttons, each of which will set a variable to a different string. When the GUI is closed, the variable, if already set, will stay set. I have this, based on the AutoIt Help example:

#include <GUIConstantsEx.au3>

Local $msg

$numberrange = ""

GUICreate ("Number Range")

$radio1 = GUICtrlCreateRadio("7000001 - 7500000", 10, 10, 120, 20)

$radio2 = GUICtrlCreateRadio("7500001 - 8000000", 10, 40, 120, 20)

$radio3 = GUICtrlCreateRadio("8000001 - 8500000", 10, 70, 120, 20)

$radio4 = GUICtrlCreateRadio("8500001 - 9000000", 10, 100, 120, 20)

$radio5 = GUICtrlCreateRadio("9000001 - 9500000", 10, 130, 120, 20)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED

$numberrange = "Range A"

Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$numberrange = "Range B"

Case $msg = $radio3 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$numberrange = "Range C"

Case $msg = $radio4 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$numberrange = "Range D"

Case $msg = $radio5 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$numberrange = "Range E"

EndSelect

The problem is that even if the user selects one of the radio buttons, if they later go to close the window, the variable is not saved. How do I fix this? Most grateful for any suggestions!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

---

Edited by playlet

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