Jump to content

Edit control with different text colors


Shy
 Share

Recommended Posts

I have an edit control I use as a log for my various application.

I want to be able to write certain lines in red text (errors) and others in blue (notification).

Is this possible?

When I use GUICtrlSetColor() it colors the entire text in the Edit control.

If it is not possible, is there anyway to color the background of just a single line?

If it is not possible, is there a "rich-text" control I can use and have this functionality?

Thank you in advance

Link to comment
Share on other sites

Help File >> User Defined Functions >> GUIRichText Management.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Should conclude from your reply there is not way to do it in the Edit control?

Not in a simple edit control and that applies to any language that uses Edit controls. The coloring requires Rich-Edit.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

When I use _GUICtrlRichEdit_SetCharColor() it colors the entire text in the control.

I could insert the new text using _GUICtrlRichEdit_AppendText() and then calculate the location and select and color just these specific text.

But, this method appears very bad in terms of performance and I was hoping you could point me to a better way to write the new line in a different color.

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

When I use _GUICtrlRichEdit_SetCharColor() it colors the entire text in the control.

I could insert the new text using _GUICtrlRichEdit_AppendText() and then calculate the location and select and color just these specific text.

But, this method appears very bad in terms of performance and I was hoping you could point me to a better way to write the new line in a different color.

Thanks

Any solution for this?

Link to comment
Share on other sites

Any solution for this?

The text colour is applied to the selected text so if you want only certain cgaracters to be coloured then you must select them first.

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

The text colour is applied to the selected text so if you want only certain cgaracters to be coloured then you must select them first.

Thanks. I saw this solution being used in some post for Single Line. I tried with multiline but failed, the selection is going wrong. Since it appears to me to be a sw-problem I created http://www.autoitscript.com/forum/index.php?showtopic=109876

Edited by ds34
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...