Eigensheep Posted May 14, 2008 Share Posted May 14, 2008 I have a GUI with a multi-line input control (GUICtrlCreateInput) and when the user clicks a button, I'd like to know what they've selected within it. I got as far as ControlFocus but then what? GUICtrlRead just gives me the whole text in the box (as you'd expect). I'm probably missing something really simple but any help would be great. Link to comment Share on other sites More sharing options...
martin Posted May 14, 2008 Share Posted May 14, 2008 (edited) I have a GUI with a multi-line input control (GUICtrlCreateInput) and when the user clicks a button, I'd like to know what they've selected within it. I got as far as ControlFocus but then what? GUICtrlRead just gives me the whole text in the box (as you'd expect). I'm probably missing something really simple but any help would be great.Look up _GUICtrlEdit_GetSel, I think that will do what you want. It returns the starting and ending character positions of the selected text, so I assume you do this $StartEnd = _GUICtrlEdit_GetSel(GuiCtrlGetHandle($edit)) $Selected = StringMid(GuiCtrlRead($Edit),$StartEnd[0] + 1,$StartEnd[1] - $StartEnd[0]) EDIT: ?? How do you get a multiline input using GUICtrlCreateInput? Do you mean GuiCtrlCreateEdit? Edited May 14, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Eigensheep Posted May 14, 2008 Author Share Posted May 14, 2008 (edited) I used GUICtrlCreateInput("",81,272,480,141,0x00201044). Sorry for the bad syle reference. While we're on the topic though, I put the style in manually to combine more than one style as I couldn't get it to work with BitAnd() BitOr() And() or Or(). Is there a way of doing this using constants? [Edit] Sorry, found that it will work if I use BitOr(). In that case the syntax becomes: GUICtrlCreateInput("",81,272,480,141,BitOr($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_WANTRETURN)). Thanks for the help. Edited May 14, 2008 by NumberDaemon 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