Enter key to press button based on which editbox has focus Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
evillemonkey
Posts: 51
Joined: 12 Nov 2015, 09:57

Enter key to press button based on which editbox has focus

21 Nov 2016, 19:13

I have a gui that has several edit boxes and buttons. Each edit box has a "ok" button next to it. How can I have it so when ever enter is pressed, the ok button next to the edit box is pressed. I can't use "Default" as there is more than one button/editbox.

OR

Have it so when enter is pressed the corresponding subroutine is run depending on which editbox has the cursor in it or focus. Let me know if you need a code example but this seems pretty straight forward.
User avatar
evillemonkey
Posts: 51
Joined: 12 Nov 2015, 09:57

Re: Enter key to press button based on which editbox has focus

30 Nov 2016, 12:44

Works like a charm. I modified it of course to fit my needs

Code: Select all

;removed as it was causing issues with my hotkeys and I didn't want to spend a lot of time taking existing things apart
#IfWinActive
#IfWinActive ahk_group AllScriptGuiWindows

;added so NumPadEnter can also be used
Enter::
NumPadEnter::
User avatar
V for Vendetta
Posts: 105
Joined: 29 Sep 2016, 11:33

Re: Enter key to press button based on which editbox has focus

30 Nov 2016, 16:18

evillemonkey wrote:Works like a charm. I modified it of course to fit my needs

Code: Select all

;removed as it was causing issues with my hotkeys and I didn't want to spend a lot of time taking existing things apart
#IfWinActive
#IfWinActive ahk_group AllScriptGuiWindows

;added so NumPadEnter can also be used
Enter::
NumPadEnter::
Wow, I totally forgot "NumPadEnter"! Thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], macromint, peter_ahk, Spawnova, wineguy and 264 guests