textArea text color

Hi All.

Have question, and hopefully someone can point me in the right direction.

When I automatically add the date and time into a text Area, I want it a different color to make it easy to find. And I can do it with the code below.

if mainWindow.notesTextArea.text = “” then
'MessageBox (“There is nothing in this field.”) // for testing only

s = theCurrentDateTime.Now.ToString
MessageBox ("The value of s is : "+s) // for testing only…
//check to see if the << signs are on the text. If so, change the color there and then set it back for anything else.
notesTextArea.TextColor = &cFF0000
notesTextArea.AddText (s)+EndOfLine.CRLF

else

end if

However, I want to change it back for more entry to basic black but if I try and change the text color it changes everything in the textArea… which makes sense.

Is it possible to have only ONE line as a different color in a text area? I have tried with the Style option, changing it when I click in the text area and it gets focus, but I am still hindered by the fact the ALL of the text changes color.

Regards

Yes indeed you can decide on the text colour for a line of text, output that, then change to another without the whole textarea changing colour. See my recent thread on the topic. What I do is this:


TextArea1.SelectionTextColor = colour
TextArea1.SelectionStart     = TextArea1.Text.Length   // selection is at end of text
TextArea1.SelectionLength    = strtext.Length
TextArea1.AddText (strtext + EndOfLine)

and it works fine. Don’t use TextColor. I tried that and got the results you observe.

Thread was “Coloured text in a scrolling TextArea”.

Thankee.

I’ll take a read, digest, and try.

Regards