egalvez Posted March 30, 2005 Share Posted March 30, 2005 Please tell me how to determine the selection in an edit control. For example, if my GUI has an edit control with several lines of text typed in it, and the user were to select one of the words, then click a button to bold the selection (to throw HTML tags before and after the selection) how would I programmatically determine what is selected? Do I need to determine both the line involved and the position of the selection on the line, or what, and how? Thank you. Link to comment Share on other sites More sharing options...
CyberSlug Posted March 30, 2005 Share Posted March 30, 2005 #include <GuiConstants.au3> $GUI = GuiCreate("Example") $editStyle = BitOr($ES_MULTILINE, $ES_NOHIDESEL) $edit = GUICtrlCreateEdit("This is sample text already provided in the edit box.", 10, 10, 200, 00, $editStyle) $button = GUICtrlCreateButton("Bold selection", 10, 150) GUISetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $button Then _SetSel() WEnd Func _SetSel() Local $text = ControlCommand($GUI, "", $edit, "GetSelected") ControlCommand($GUI, "", $edit, "EditPaste", '<b>' & $text & '</b>') EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
egalvez Posted March 30, 2005 Author Share Posted March 30, 2005 Thank you. 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