AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Variating result via checkboxes

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jajo



Joined: 01 May 2005
Posts: 10

PostPosted: Sun May 01, 2005 7:57 pm    Post subject: Variating result via checkboxes Reply with quote

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 Rolling Eyes

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
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Sun May 01, 2005 8:34 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Guest






PostPosted: Sun May 01, 2005 8:55 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group