effer Posted December 29, 2005 Share Posted December 29, 2005 How do you make a script able to accept an Enter press while the curser is located in an input field? $user = GUICtrlCreateInput ( "", 150, 30, 50, 20) $pass = GUICtrlCreateInput ( "", 150, 55, 70, 20, $ES_PASSWORD) $ok = GUICtrlCreateButton("OK", 70, 80, 60) GUICtrlSetOnEvent($ok, "saveinfo") GUISetState(@SW_SHOW) Func saveinfo() $login = GUICtrlRead($user) $code = GUICtrlRead($pass) GUIDelete(); EndFunc When Enter is pressed, then the function saveinfo() should be run. How to do that? /Effer Link to comment Share on other sites More sharing options...
BigDod Posted December 29, 2005 Share Posted December 29, 2005 How do you make a script able to accept an Enter press while the curser is located in an input field? $user = GUICtrlCreateInput ( "", 150, 30, 50, 20) $pass = GUICtrlCreateInput ( "", 150, 55, 70, 20, $ES_PASSWORD) $ok = GUICtrlCreateButton("OK", 70, 80, 60) GUICtrlSetOnEvent($ok, "saveinfo") GUISetState(@SW_SHOW) Func saveinfo() $login = GUICtrlRead($user) $code = GUICtrlRead($pass) GUIDelete(); EndFunc When Enter is pressed, then the function saveinfo() should be run. How to do that? /EfferI assume that you want pressing enter to have the same effect as pushing the OK button. If this is correct you should look at $BS_DEFPUSHBUTTON. You will find it under GUI Control Styles Appendix in the help file. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
nfwu Posted December 29, 2005 Share Posted December 29, 2005 (edited) This has already been brought up a couple of times already, using the search feature can bring these up. Any way, the way to do it is to put a very tiny button which gets activated when you hit enter. Or allow a button to get pressed when enteris hit. Like this: $user = GUICtrlCreateInput ( "", 150, 30, 50, 20) $pass = GUICtrlCreateInput ( "", 150, 55, 70, 20, $ES_PASSWORD) $ok = GUICtrlCreateButton("OK", 70, 80, 60, 25, $BS_DEFPUSHBUTTON ) GUICtrlSetOnEvent($ok, "saveinfo") GUISetState(@SW_SHOW) Func saveinfo() $login = GUICtrlRead($user) $code = GUICtrlRead($pass) GUIDelete(); EndFunc Look up $BS_DEFPUSHBUTTON in the help file. EDIT: BigDod beat me to it!!! Edited December 29, 2005 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 29, 2005 Share Posted December 29, 2005 (edited) you can look for _ispressed() function by ezzetabi.$user = GUICtrlCreateInput ( "", 150, 30, 50, 20) $pass = GUICtrlCreateInput ( "", 150, 55, 70, 20, $ES_PASSWORD) $ok = GUICtrlCreateButton("OK", 70, 80, 60, 25, $BS_DEFPUSHBUTTON ) GUISetState(@SW_SHOW) ;;;i took out GUIctrlsetonevent if _Ispressed('0D') Then saveinfo() Endif Func saveinfo() $login = GUICtrlRead($user) $code = GUICtrlRead($pass) GUIDelete(); EndFunchttp://www.autoitscript.com/forum/index.ph...wtopic=5760&hl= Edited December 29, 2005 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
effer Posted December 29, 2005 Author Share Posted December 29, 2005 OK, $BS_DEFPUSHBUTTON works. I tried to use the search function, but I couldn't find anything (I didn't know, what words to search for ) Thanks for the answers /Effer 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