BALA Posted January 20, 2007 Share Posted January 20, 2007 I want to have something happen when an Enter key is pressed in an input. I tried having: If _IsPressed("0D") Then ;whatever But that would go off whenever the Enter key was pressed, regardless of if the user had the input selected. I guess what I need is something like GUICtrlRead, but will able able to detect keys pressed in it. [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
jvanegmond Posted January 20, 2007 Share Posted January 20, 2007 This should be in AutoIt1-2-3 #include <GUIConstants.au3> GUICreate("Test", 200,100) $Input = GUICtrlCreateEdit("",5,5,190,21, BitOR($ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL)) GUISetState() While 1 $Read = GUICtrlRead($Input) If StringRight($Read,2) = @CRLF Then $Read = StringTrimRight($Read,2) GUICtrlSetData($Input,$Read) MsgBox(0, "Test data", $Read) EndIf IF GUIGetMsg() = -3 Then Exit WEnd github.com/jvanegmond Link to comment Share on other sites More sharing options...
BALA Posted January 20, 2007 Author Share Posted January 20, 2007 Will this work with a combo? [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
jvanegmond Posted January 20, 2007 Share Posted January 20, 2007 No, combo boxes will not accept an Enter. You will need a different way to check for this. I once did a listbox like that, I hotkeyed the Enter and checked if the control and the window were both active once enter was pressed, if it was not I would unhotkey that enter and Send it. This has a downside to it, if the active window does not accept simulated keys. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Helge Posted January 20, 2007 Share Posted January 20, 2007 Did I miss your point (hope so) or is this what you want ?#include <GUIConstants.au3> $hGUI = GUICreate("", 300, 50) $nInput = GUICtrlCreateInput("", 10, 10, 280, 21) GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $nInput WinSetTitle($hGUI, "", GUICtrlRead($nInput)) EndSwitch WEnd Link to comment Share on other sites More sharing options...
mozart90 Posted January 23, 2007 Share Posted January 23, 2007 (edited) Hi perhaps take a look here http://www.autoitscript.com/forum/index.phregards mozart90 Edited January 23, 2007 by mozart90 Easy Zip Compression using XP Link to comment Share on other sites More sharing options...
Helge Posted January 23, 2007 Share Posted January 23, 2007 ...perhaps take a look here...In that topic it's shown how to do it with a edit-control, while BALA here has a input-control.Also my script above shows the way of doing it with a input-control, and there's seriously nothing advanced with it...Just simple GUIGetMsg-usage. Link to comment Share on other sites More sharing options...
eltorro Posted January 23, 2007 Share Posted January 23, 2007 there's seriously nothing advanced with it...Just simple GUIGetMsg-usage.I agree, this works for 99.999% of us.eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code 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