Jump to content
Sign in to follow this  
AustrianOak

hotkeyset inside input

Recommended Posts

AustrianOak

is there a way i can set a hotkey to the 'enter' key when my cursor is active inside an input box. im asking this because it is frustrating having to continuously click a button to take action and would rather hit enter.

help? :)

Share this post


Link to post
Share on other sites
AustrianOak

thats what i want yes.

Share this post


Link to post
Share on other sites
AustrianOak

Thanks Jiim! :)

Thats been a nag since the beginning.

Share this post


Link to post
Share on other sites
AustrianOak

@Jiim:

I found a problem doing it this way... :|

When ever I type text into the input and then go to drag the window around, it will actually "press enter" and input the data in the input even though I never pressed enter.

How can I fix this?

Share this post


Link to post
Share on other sites
Valuater

show your code

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
AustrianOak

Case $msg = $Input
            Func1()

Share this post


Link to post
Share on other sites
Valuater

Case $msg = $Input
             Func1()
that cant be right, evertime you click the $input Func1 will execute

... with that much code i cant help.... and with that much code its really stupid to even think i could

... so = your-on-your-own

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
DW1

If there is a submit type button available then you can use the $BS_DEFPUSHBUTTON style on that button to make enter in the input the same as pressing this button.

Description of $BS_DEFPUSHBUTTON from help file:

"Creates a push button with a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely option, or default."

Share this post


Link to post
Share on other sites
AustrianOak

danwilli:

there is not a submit type "button" but there is a pic control i use for submit.

would the style still work?

Share this post


Link to post
Share on other sites
Valuater

sometimes

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
AustrianOak

just tried it, guess it doesn't...

GUICtrlCreateIcon(@ScriptDir & "\resources.dll", 1, 132, 61, 24, 24, $BS_DEFPUSHBUTTON)

Edited by nowagain

Share this post


Link to post
Share on other sites
NELyon

Check out this example using Accelerators. Click on either input box, type something in, and press enter.

Clicking the button doesn't work correctly though. It returns the buttons text. Gotta work that out.

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
$GUI = GUICreate("Test", 288, 150, -1, -1, $WS_SIZEBOX)
$hInput = GUICtrlCreateInput("Enter something here", 44,  20)
$hInput2 = GUICtrlCreateInput("Or enter something here", 44, 100)
$hButton = GUICtrlCreateButton("Click or press enter", 95, 50)
$hDummy = GUICtrlCreateDummy()
Dim $hotkey[1][2] = [["{enter}", $hButton]]
GUISetAccelerators($hotkey)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $hButton
            $hndl = ControlGetText("", "", ControlGetFocus($GUI))
            MsgBox(0, "Test", "You typed """ & $hndl&'"' & @CRLF & @AutoItVersion)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×