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 

Gui Edit - On Enter

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



Joined: 24 Jun 2008
Posts: 104

PostPosted: Tue Dec 08, 2009 3:26 am    Post subject: Gui Edit - On Enter Reply with quote

I am trying to start a subroutine once "enter" has been hit after typing something in an edit box. For example, once I am finished typing whatever I want in the edit box, I do not want to go hit the submit button, rather, i would like to just hit enter to have that start. Much like when you are signing into your gmail account, you don't have to actually click "login" you can just hit enter once you've typed your username and password.

Hope this is possible, I could not find a simple solution yet.
_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight
Back to top
View user's profile Send private message
jaco0646



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

PostPosted: Tue Dec 08, 2009 4:30 am    Post subject: Reply with quote

Set the button you want to trigger with the Enter key as the Default button.
Code:
Gui, Add, Edit, w300 vEdit
Gui, Add, Button, Default, Submit
Gui, Add, Button, x+10 wp, Clear

Gui, Show
return
GuiClose:
 ExitApp

ButtonSubmit:
 Gui, Submit, NoHide
 MsgBox,,,%Edit%, 1
return

ButtonClear:
 GuiControl,,Edit
return


AHK Help File wrote:
Code:
Example: Gui, Add, Button, Default, OK
The example above includes the word Default in its Options to make "OK" the default button. The default button's action is automatically triggered whenever the user presses ENTER, except when the keyboard focus is on a different button or a multi-line edit control having the WantReturn style.
Back to top
View user's profile Send private message Visit poster's website
smikkelsen not logged in
Guest





PostPosted: Tue Dec 08, 2009 6:48 am    Post subject: Reply with quote

Thank you so much, I guess i was looking in the wrong place.
Back to top
CPL101
Guest





PostPosted: Fri Sep 17, 2010 6:14 pm    Post subject: Default Return - multiple edit boxes Reply with quote

I understand the default parameter.

My question is, I have multiple edit boxes and submit buttons next to them. I would like to associate a submit button with the corresponding edit box, so that regardless of which edit box you are typing in, hitting "enter" will submit the query.

Thanks!
Back to top
jaco0646



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

PostPosted: Fri Sep 17, 2010 9:25 pm    Post subject: Reply with quote

Generally, a design with multiple inputs still only includes one submit button, which is the default for all input controls. Multiple buttons providing the same function tend to look cluttered and confusing. Additionally, multiple edit controls can often be replaced by one ListView.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
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