Jump to content

hotkeyset inside input


Recommended Posts

@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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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."

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...