qmark Posted September 8, 2005 Posted September 8, 2005 how is it possible to get a text partially highlighted in an edit control?
Lazycat Posted September 8, 2005 Posted September 8, 2005 Yes, you can use GUICtrlSendMsg with EM_SETSEL: $EM_SETSEL = 0x00B1 GUICtrlSendMsg($edit_control, $EM_SETSEL, $start_char, $end_char) Text will be highlited between start_char and end_char. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
qmark Posted September 8, 2005 Author Posted September 8, 2005 I'm probbally to stupid or "newpid" because it doesn't work could your check my code please? #include <GUIConstants.au3> $start_char = 1 $end_char = 100 $EM_SETSEL = 0x00B1 GUICreate("Address",600,400) ; will create a dialog box that when displayed is centered $buttonX = GuiCtrlCreateButton ("save",190,10,80,20) $buttonH = GuiCtrlCreateButton ("hilight",0,10,80,20) $myedit=GUICtrlCreateEdit ("", 0,32,600,450,$ES_AUTOVSCROLL+$WS_VSCROLL) $file = FileOpen("C:\todo.txt", 0) $chars = FileRead($file,99999) GUISetState () GUICtrlSetData ($myedit, $chars ,1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select case $msg = $buttonH GUICtrlSendMsg($myedit, $EM_SETSEL, $start_char, $end_char) MsgBox(0,"", "ok",2) EndSelect Wend
Lazycat Posted September 8, 2005 Posted September 8, 2005 Oh, yes, you should set focus on the edit control before. GUICtrlSetState($myedit, $GUI_FOCUS) GUICtrlSendMsg($myedit, $EM_SETSEL, $start_char, $end_char) Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
qmark Posted September 8, 2005 Author Posted September 8, 2005 thanx lazycat it works fine. just a last one does it work too, to change the color of this part of the text? I'mean instead of highlighting it
jpm Posted September 8, 2005 Posted September 8, 2005 qmark said: thanx lazycat it works fine.just a last onedoes it work too, to change the color of this part of the text?I'mean instead of highlighting it<{POST_SNAPBACK}>No as the edit control cannot received rich text :">
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