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 

Hide Controls

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



Joined: 20 Sep 2005
Posts: 100

PostPosted: Sat Apr 19, 2008 6:14 pm    Post subject: Hide Controls Reply with quote

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



Joined: 07 Oct 2006
Posts: 666
Location: MN, USA

PostPosted: Sat Apr 19, 2008 6:49 pm    Post subject: Reply with quote

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






PostPosted: Sun Apr 20, 2008 4:15 am    Post subject: Reply with quote

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






PostPosted: Sun Apr 20, 2008 4:19 am    Post subject: Reply with quote

sorry - forgot the code tags Evil or Very Mad
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

PostPosted: Sun Apr 20, 2008 7:06 am    Post subject: Reply with quote

Thank you both

That's perfect, most appriciated
Back to top
View user's profile Send private message
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