AustrianOak Posted June 11, 2008 Share Posted June 11, 2008 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? Link to comment Share on other sites More sharing options...
James Posted June 11, 2008 Share Posted June 11, 2008 So when you press enter on an input it will do something? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
AustrianOak Posted June 11, 2008 Author Share Posted June 11, 2008 thats what i want yes. Link to comment Share on other sites More sharing options...
James Posted June 11, 2008 Share Posted June 11, 2008 Easy Give your input a name $myInput then on the case statement such as Case $GUI_EVENT_CLOSE do the same but Case $myInput. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
AustrianOak Posted June 11, 2008 Author Share Posted June 11, 2008 Thanks Jiim! Thats been a nag since the beginning. Link to comment Share on other sites More sharing options...
James Posted June 11, 2008 Share Posted June 11, 2008 Thanks Jiim! Thats been a nag since the beginning.No problem Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
AustrianOak Posted June 12, 2008 Author Share Posted June 12, 2008 @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 More sharing options...
Valuater Posted June 12, 2008 Share Posted June 12, 2008 show your code 8) Link to comment Share on other sites More sharing options...
AustrianOak Posted June 12, 2008 Author Share Posted June 12, 2008 Case $msg = $Input Func1() Link to comment Share on other sites More sharing options...
Valuater Posted June 12, 2008 Share Posted June 12, 2008 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) Link to comment Share on other sites More sharing options...
DW1 Posted June 12, 2008 Share Posted June 12, 2008 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." AutoIt3 Online Help Link to comment Share on other sites More sharing options...
AustrianOak Posted June 12, 2008 Author Share Posted June 12, 2008 danwilli: there is not a submit type "button" but there is a pic control i use for submit. would the style still work? Link to comment Share on other sites More sharing options...
Valuater Posted June 12, 2008 Share Posted June 12, 2008 sometimes 8) Link to comment Share on other sites More sharing options...
AustrianOak Posted June 12, 2008 Author Share Posted June 12, 2008 (edited) just tried it, guess it doesn't... GUICtrlCreateIcon(@ScriptDir & "\resources.dll", 1, 132, 61, 24, 24, $BS_DEFPUSHBUTTON) Edited June 12, 2008 by nowagain Link to comment Share on other sites More sharing options...
Bert Posted June 12, 2008 Share Posted June 12, 2008 You could simply make the hotsetkey a combo of "z{ENTER}". this would mean when you hit "z" and the enter key at the same time, it would do what you want. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
NELyon Posted June 12, 2008 Share Posted June 12, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now