Beege Posted January 6, 2010 Share Posted January 6, 2010 (edited) Anyone know how I can append different color text to a RichEdit without changing all the color of all the previous text? Any help would be great. Thanks #include <ButtonConstants.au3> #Include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GUI = GUICreate("Form1", 405, 333) $btRed = GUICtrlCreateButton("RED", 26, 282, 81, 33, $WS_GROUP) $btGreen = GUICtrlCreateButton("Green", 162, 282, 81, 33, $WS_GROUP) $btBlue = GUICtrlCreateButton("Blue", 298, 282, 81, 33, $WS_GROUP) $Input1 = GUICtrlCreateInput("Some Text to append", 16, 248, 377, 21) $RichEdit = _GUICtrlRichEdit_Create($GUI, "" & @CRLF, 32, 8, 345, 225, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) GUISetState(@SW_SHOW) Global Const $cGreen = '65280' Global Const $cRed = '255' Global Const $cBlue = '16711680' While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($RichEdit) Exit Case $btBlue _GuiCtrlRichEdit_SetCharColor($RichEdit, $cBlue) _GUICtrlRichEdit_AppendText($RichEdit, GUICtrlRead($Input1) & @CRLF) Case $btRed _GuiCtrlRichEdit_SetCharColor($RichEdit, $cRed) _GUICtrlRichEdit_AppendText($RichEdit, GUICtrlRead($Input1) & @CRLF) Case $btGreen _GuiCtrlRichEdit_SetCharColor($RichEdit, $cGreen) _GUICtrlRichEdit_AppendText($RichEdit, GUICtrlRead($Input1) & @CRLF) EndSwitch WEnd Edited January 6, 2010 by Beege Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
James Posted January 6, 2010 Share Posted January 6, 2010 Check out Betapad. Every function there was native to the COM object, no UDFs. If you need help, I am the creator of it, so just PM me.Also, it will not run on the latest versions of AutoIt, so some things will need to change. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Beege Posted January 6, 2010 Author Share Posted January 6, 2010 Looks pretty cool. Ill be sure to check that out. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
James Posted January 6, 2010 Share Posted January 6, 2010 Looks pretty cool. Ill be sure to check that out.Thanks! There is also the forum thread you can read here.I remember writing this when I started AutoIt... Ahh the good old days. It's probably very bad coding. It was a somewhat joint effort between myself and another member Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Beege Posted January 6, 2010 Author Share Posted January 6, 2010 (edited) Got it! Thanks again for looking expandcollapse popup#include <ButtonConstants.au3> #Include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GUI = GUICreate("Form1", 405, 333) $btRed = GUICtrlCreateButton("RED", 26, 282, 81, 33, $WS_GROUP) $btGreen = GUICtrlCreateButton("Green", 162, 282, 81, 33, $WS_GROUP) $btBlue = GUICtrlCreateButton("Blue", 298, 282, 81, 33, $WS_GROUP) $Input1 = GUICtrlCreateInput("", 16, 248, 377, 21) $RichEdit = _GUICtrlRichEdit_Create($GUI, "" & @CRLF, 32, 8, 345, 225, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) GUISetState(@SW_SHOW) Global Const $cGreen = '65280' Global Const $cRed = '255' Global Const $cBlue = '16711680' While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($RichEdit) Exit Case $btBlue _GUICtrlRichEdit_AppendText($RichEdit, @CRLF & GUICtrlRead($Input1)) _GuiCtrlRichEdit_SetSel($RichEdit, _GuiCtrlRichEdit_GetFirstCharPosOnLine($RichEdit), -1, True) _GuiCtrlRichEdit_SetCharColor($RichEdit, $cBlue) Case $btRed _GUICtrlRichEdit_AppendText($RichEdit, @CRLF & GUICtrlRead($Input1)) _GuiCtrlRichEdit_SetSel($RichEdit, _GuiCtrlRichEdit_GetFirstCharPosOnLine($RichEdit), -1, True) _GuiCtrlRichEdit_SetCharColor($RichEdit, $cRed) Case $btGreen _GUICtrlRichEdit_AppendText($RichEdit, @CRLF & GUICtrlRead($Input1)) _GuiCtrlRichEdit_SetSel($RichEdit, _GuiCtrlRichEdit_GetFirstCharPosOnLine($RichEdit), -1, True) _GuiCtrlRichEdit_SetCharColor($RichEdit, $cGreen) EndSwitch WEnd Edited January 6, 2010 by Beege Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator 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