 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
jajo
Joined: 01 May 2005 Posts: 10
|
Posted: Sun May 01, 2005 7:57 pm Post subject: Variating result via checkboxes |
|
|
How can Iget various results in correspondence with checkboxes?
Basicly I want to get a messagebox, that displays the checked choices, after pressing the button.
Unfortunately the help files are not newbie friendly
I would have very much appreciated it, if the solution derives from my feeble attempts:
| Code: | Gui, Show, x320 y240 h136 w128, Test
Gui, Add, Checkbox, x32 y40, First
Gui, Add, Checkbox, x32 y72, Second
Gui, Add, Button, x16 y104 w96 h24, Gimme
return
GuiClose:
ExitApp
ButtonGimme:
Gui, Submit, NoHide
if ( (GuiControlGet, First) = 1 )
if ( (GuiControlGet, Second) = 1 )
MsgBox First + second
else
MsgBox First
else
MsgBox None
return
|
|
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2436
|
Posted: Sun May 01, 2005 8:34 pm Post subject: |
|
|
Hi jajo, To get the value of a checkbox you can assign a variable to the checkbox using vVariableName. This variable would have the value of the CheckBox when Gui, Submit is used. GuiControlGet isn't necessary in this case since you used Gui, Submit, NoHide but if you did want to use GuiControlGet you would need to store the value in a variable first then test the value with if statements after. | Quote: | | GuiControlGet, OutputVar [, Sub-command, ControlID, Param4] |
| Code: | Gui, Show, x320 y240 h136 w128, Test
Gui, Add, Checkbox, x32 y40 vFirst, First
Gui, Add, Checkbox, x32 y72 vSecond, Second
Gui, Add, Button, x16 y104 w96 h24, Gimme
return
GuiClose:
ExitApp
ButtonGimme:
Gui, Submit, NoHide
if First = 1
if Second = 1
MsgBox First + second
else
MsgBox First
else if Second = 1
MsgBox Second
else
MsgBox None
return
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Sun May 01, 2005 8:55 pm Post subject: |
|
|
| Thank you for your quick answer corrupt. I find your solution much more appealing and it also clarifies a few other issues I have been having. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|