Colored Text

BlitzPlus Forums/BlitzPlus Programming/Colored Text

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you want to just highlight certain parts of a textarea, use the FormatTextAreaText() command and jusr give it the starting character and length of text to format. This will only work on TextAreas though, TextFields and other gadgets will have to use a Win32 API function (userlib) to change colors. Look on MSDN for some help with the Windows APIs.

In case my explanation of FormatTextAreaText() didn't make any sense, here's an example that might help get you started:
TextArea=CreateTextArea(0,0,Width,Height,Window)
SetTextAreaText(TextArea,"Line 1"+Chr(10)+"Line 2")

FormatTextAreaText(TextArea,255,0,0,0,1,6)
FormatTextAreaText(TextArea,0,0,255,0,8,6)

I haven't tried this (I don't have BlitzPlus right now) but this should work for you. Look at the TextArea section of the docs for some more on the formatting commands.