 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
squalito
Joined: 23 Jun 2009 Posts: 10
|
Posted: Thu Jun 25, 2009 12:50 pm Post subject: GUI: Automaticly Display radio if checkbox is On. Else Hide |
|
|
Hello
I have a GUI like this one for example
| Code: |
Gui, Add, Text, x12 y12 w100 h20 , Nom du Skin:
Gui, Add, Edit, x92 y12 w170 h20 vSkin, %DSkin%
Gui, Add, Button, x62 y262 w70 h20 , OK
Gui, Add, Button, x262 y262 w70 h20 , Cancel
Gui, Add, Text, x12 y52 w100 h20 , Lancer PlaceMint :
Gui, Add, CheckBox, x112 y42 w60 h30 vPlaceMint %CPM%,
Gui, Add, GroupBox, x12 y92 w110 h150 , LIMITES
Gui, Add, Radio, x22 y112 w100 h30 vNL %CNL%, No-Limit
Gui, Add, Radio, x22 y142 w100 h30 vPL %CPL%, Pot-Limit
Gui, Add, Radio, x22 y172 w100 h30 vFL %CFL%, Fix Limit
Gui, Add, GroupBox, x132 y92 w120 h150 , MISES
Gui, Add, Radio, x142 y112 w100 h30 vMic %CMic%, Micro
Gui, Add, Radio, x142 y142 w100 h30 vMin %CLow%, Minimales
Gui, Add, Radio, x142 y172 w100 h30 vMoy %CMed%, Moyennes
Gui, Add, Radio, x142 y202 w100 h30 vMax %CHig%, Maximales
Gui, Add, GroupBox, x262 y92 w120 h150 , TABLES
Gui, Add, Radio, x272 y112 w100 h30 vSH %CSH%, Short handed
Gui, Add, Radio, x272 y142 w100 h30 vFR %CFH%, Complète
Gui, Add, Radio, x272 y172 w100 h30 vHU %CHU%, Heads Up
Gui, Add, Radio, x272 y202 w100 h30 vAll %CAll%, Toutes
; Generated using SmartGUI Creator 4.0
Gui, Show, x279 y217 h311 w403, Chargeur de Skins Ongame V2.5
|
What I'd like is to hide some Radio if a checkbox isn't set, else show some radio.
I'd like to show these radio, as soon as the user has checked the checkbox, and hide them as soon as the user has untick the checkbox
Something like
OnTick()
Is it possible ?
Because yet, what I do is show this GUI, then in ButtonOK do a GUI,Submit, test the value of the checkbox and run another AHK script which has a new GUI
Thanks |
|
| Back to top |
|
 |
Murp|e
Joined: 12 Jan 2007 Posts: 531 Location: Norway
|
Posted: Thu Jun 25, 2009 4:38 pm Post subject: |
|
|
By including a g-label to your checkbox control, you can specify a subroutine that will run everytime the checkbox control is clicked. In that subroutine you retrieve the status of the control (Checked or not) and based on that you can hide/show your radio controls. Like so:
| Code: | Gui, Add, CheckBox, x112 y42 w60 h30 vPlaceMint gOnTick %CPM%,
OnTick:
guicontrolget, CheckStatus, ,PlaceMint
msgbox, %CheckStatus%
;Hide or show your radio buttons here
return |
|
|
| Back to top |
|
 |
squalito
Joined: 23 Jun 2009 Posts: 10
|
Posted: Fri Jun 26, 2009 1:50 pm Post subject: |
|
|
Thanks a lot it's exactly what I was looking for
Didn't know the g-label !!
very good ! |
|
| Back to top |
|
 |
squalito
Joined: 23 Jun 2009 Posts: 10
|
Posted: Fri Jun 26, 2009 2:10 pm Post subject: |
|
|
Hmm
Is it possible to hide/show a groupbox and all it contents or do we have to hide/show all controls one by one
For example
| Code: | Gui, Add, CheckBox, x112 y42 w60 h30 vPlaceMint gOnTick %CPM%,
Gui, Add, GroupBox, x132 y92 w120 h150 vGrpMises, MISES
Gui, Add, Radio, x142 y112 w100 h30 vMic %CMic%, Micro
Gui, Add, Radio, x142 y142 w100 h30 vMin %CLow%, Minimales
Gui, Add, Radio, x142 y172 w100 h30 vMoy %CMed%, Moyennes
Gui, Add, Radio, x142 y202 w100 h30 vMax %CHig%, Maximales |
I have a groupbox which contains 4 radio. If I Hide the groupbox, the 4 radio are still shown.
| Code: | OnTick:
guicontrolget, CheckStatus, ,PlaceMint
msgbox, %CheckStatus%
;Hide or show your radio buttons here
if (CheckStatus = 1)
GuiControl, Disable, GrpMises
Else
GuiControl, Enable, GrpMises
return |
Do I have to hide all these radio one by one or is there a quick solution to hide the groupbox and it contents ? |
|
| Back to top |
|
 |
Murp|e
Joined: 12 Jan 2007 Posts: 531 Location: Norway
|
Posted: Wed Jul 15, 2009 1:45 pm Post subject: |
|
|
| Quote: | | Is it possible to hide/show a groupbox and all it contents or do we have to hide/show all controls one by one |
As far as I know this is not possible (I haven't actually checked/searched), but it might be worth the effort to code this functionality yourself. I don't think it would be too complicated/difficult, something like this:
| Code: | GroupBox(GroupBoxName, Visibility)
{
;loop through all controls in GUI and get size and position for each
;for each control check if it is within the boundaries of GroupBoxName and if it is then toggle Visibility
}
|
|
|
| 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
|