 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Sat Apr 19, 2008 6:14 pm Post subject: Hide Controls |
|
|
Hi
Would it be possible for someone to show me how to hide the following controls instead of using a separate gui, because when the tick is removed and replaced the gui resets everything.
I would just like the date fields to appear when the checkbox is ticked and hidden when not ticked, as I'm hoping that this will then not reset the other fields.
| Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
Start:
Gui, Add, Text, x20 y30 h20 , Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y60 w440 h20 ,
Gui, Add, Text, x20 y130 h20 , Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y160 w440 h20 ,
Gui, Add, CheckBox, x20 y210 w440 gRange vRange, Do you want to choose an output date range?
Gui, Add, GroupBox, x40 y240 w400 h60
Gui, Add, Button, default x50 y310 w100 h30 , Done
Gui, Add, Button, x190 y310 w100 h30 , Help
Gui, Add, Button, x330 y310 w100 h30 , Cancel
Gui, Show, w480 h380, Gui Window
Return
ButtonCancel:
GuiClose:
ExitApp
Range:
GuiControlGet, Range, , Range
If Range=1
{
week=
EnvAdd, week, 7 , d
Gui, Font, cBlack norm
Gui, Add, DateTime, x116 y265 w100 h20
Gui, Add, DateTime, x286 y265 w100 h20
Gui, Add, Text, x66 y268 w50 h20, From:
Gui, Add, Text, x256 y268 w30 h20, To:
return
}
Else
Gui, Destroy
Goto Start |
Just one more issue is when the gui is first opened how to I get the cursor to start in the 2nd edit box instead of the first.
Thank you |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 666 Location: MN, USA
|
Posted: Sat Apr 19, 2008 6:49 pm Post subject: |
|
|
| Code: | #SingleInstance Force
#NoEnv
Gui, Add, Text, x20 y30 h20, Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y60 w440 h20
Gui, Add, Text, x20 y130 h20, Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y160 w440 h20
Gui, Add, CheckBox, x20 y210 w440 gRange vRange, Do you want to choose an output date range?
Gui, Add, GroupBox, x40 y240 w400 h60
Gui, Add, Button, default x50 y310 w100 h30, Done
Gui, Add, Button, x190 y310 w100 h30, Help
Gui, Add, Button, x330 y310 w100 h30, Cancel
Gui, Font, cBlack norm
Gui, Add, DateTime, x116 y265 w100 h20 vDT1 Disabled
Gui, Add, DateTime, x286 y265 w100 h20 vDT2 Disabled
Gui, Add, Text, x66 y268 w50 h20, From:
Gui, Add, Text, x256 y268 w30 h20, To:
Gui, Show, w480 h380, Gui Window
GuiControl, Focus, Edit2
Return
ButtonCancel:
GuiClose:
ExitApp
Range:
Gui, Submit, NoHide
GuiControl, Enable%Range%, DT1
GuiControl, Enable%Range%, DT2
return |
You also don't need to set absolute coordinates for each control. GUI _________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Apr 20, 2008 4:15 am Post subject: |
|
|
Or a slight variation of jaco0646's post, that actually hides the controls.
#SingleInstance Force
#NoEnv
Gui, Add, Text, x20 y30 h20, Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y60 w440 h20
Gui, Add, Text, x20 y130 h20, Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y160 w440 h20
Gui, Add, CheckBox, x20 y210 w440 gRange vRange, Do you want to choose an output date range?
Gui, Add, GroupBox, x40 y240 w400 h60
Gui, Add, Button, default x50 y310 w100 h30, Done
Gui, Add, Button, x190 y310 w100 h30, Help
Gui, Add, Button, x330 y310 w100 h30, Cancel
Gui, Font, cBlack norm
Gui, Add, DateTime, x116 y265 w100 h20 vDT1 Hidden
Gui, Add, DateTime, x286 y265 w100 h20 vDT2 Hidden
Gui, Add, Text, x66 y268 w50 h20, From:
Gui, Add, Text, x256 y268 w30 h20, To:
Gui, Show, w480 h380, Gui Window
GuiControl, Focus, Edit2
Return
ButtonCancel:
GuiClose:
ExitApp
Range:
Gui, Submit, NoHide
GuiControl, Show%Range%, DT1
GuiControl, Show%Range%, DT2
return |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Apr 20, 2008 4:19 am Post subject: |
|
|
sorry - forgot the code tags
Or a slight variation of jaco0646's post, that actually hides the controls.
| Code: | #SingleInstance Force
#NoEnv
Gui, Add, Text, x20 y30 h20, Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y60 w440 h20
Gui, Add, Text, x20 y130 h20, Type the file name or complete path if not in the default folder`r(...My Documents)
Gui, Add, Edit, x20 y160 w440 h20
Gui, Add, CheckBox, x20 y210 w440 gRange vRange, Do you want to choose an output date range?
Gui, Add, GroupBox, x40 y240 w400 h60
Gui, Add, Button, default x50 y310 w100 h30, Done
Gui, Add, Button, x190 y310 w100 h30, Help
Gui, Add, Button, x330 y310 w100 h30, Cancel
Gui, Font, cBlack norm
Gui, Add, DateTime, x116 y265 w100 h20 vDT1 Hidden
Gui, Add, DateTime, x286 y265 w100 h20 vDT2 Hidden
Gui, Add, Text, x66 y268 w50 h20, From:
Gui, Add, Text, x256 y268 w30 h20, To:
Gui, Show, w480 h380, Gui Window
GuiControl, Focus, Edit2
Return
ButtonCancel:
GuiClose:
ExitApp
Range:
Gui, Submit, NoHide
GuiControl, Show%Range%, DT1
GuiControl, Show%Range%, DT2
return |
|
|
| Back to top |
|
 |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Sun Apr 20, 2008 7:06 am Post subject: |
|
|
Thank you both
That's perfect, most appriciated |
|
| 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
|