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 

Hitting Enter from editbox to launch sub/button [solved]

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



Joined: 24 Dec 2008
Posts: 1308
Location: :noitacoL

PostPosted: Thu Mar 04, 2010 10:38 pm    Post subject: Hitting Enter from editbox to launch sub/button [solved] Reply with quote

I am sort embarassed becuase I cannot remember this, I had this working at one time, but cannot find the snippet that I need now. Embarassed


Basically, while the curser is in an Edit field in a GUI, I would simply like to hit 'enter' to make it launch the associated button, rather than making the user click button_x.

I haven't had a need for this in a while, and can't seem to bring up the right kind of search terms. I know its painfully simple but just adding a gLable to the edit field doesnt work, as it runs the subroutine once user enters -any- data. Obvisouly we would want them to finish typing first befroe launching the sub.


Last edited by Carcophan on Thu Mar 04, 2010 11:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
jpjazzy



Joined: 16 Feb 2010
Posts: 799
Location: SciTE

PostPosted: Thu Mar 04, 2010 10:42 pm    Post subject: Re: Hitting Enter from editbox to launch sub/button Reply with quote

Like this?

Code:
Enter::
IfWinActive, (*Your wintitle*)
{
GuiControlGet, focused_control, FocusV
If (%focused_control% = *EDITBOX NAME*)
{
   Goto, Enter
}
}
IfWinNotActive, (*Your wintitle*)
{
   Send, {Enter Up}
        Keywait, {Enter}
        Send, {Enter Down}
   }
Return


Last edited by jpjazzy on Thu Mar 04, 2010 10:43 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
jaco0646



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

PostPosted: Thu Mar 04, 2010 10:43 pm    Post subject: Reply with quote

Button
AHK Help File wrote:
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...
Back to top
View user's profile Send private message Visit poster's website
Carcophan



Joined: 24 Dec 2008
Posts: 1308
Location: :noitacoL

PostPosted: Thu Mar 04, 2010 11:20 pm    Post subject: Reply with quote

jaco0646 wrote:
Button
AHK Help File wrote:
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...



@jpjazzy: Not quite, but Thank you for your assistance anyway Razz

@jaco, Thats what I was talking about, yes! I had everything except for the magic word 'defualt' in there the first time through.

Gui, Add, Button, x-1000 y-1000 Default gCheckAcctNum, OK Cool
Back to top
View user's profile Send private message
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