Blitz3D+ Command Reference

FormatTextAreaText textarea,red,green,blue,flags[,pos][,len][,units]

Parameters

textarea - text area gadget

red,green,blue - text colour components, 0 to 255

flags - style bits, added together:
0: plain
1: bold
2: italic

pos (optional) - start of the range; 0 (default)

len (optional) - length of the range; -1 formats to the end (default)

units (optional) - how pos and len are measured:
1: characters (default)
2: lines

Description

Colours and styles a range of text in a text area.

Text areas are rich - different ranges can have different looks - and this is the command that paints them. Give a range a colour plus bold (1), italic (2) or both (3). The defaults cover the whole text; with units 2, pos and len pick whole lines instead of characters, which is the natural way to tint one log line:

FormatTextAreaText log,255,80,80,1,lineNumber,1,2 ; one line, red and bold

Formatting is exact about its flags: passing 0 makes the range plain again, clearing any bold or italic it had. Character positions are whole Unicode characters, shared with TextAreaText, TextAreaChar and friends; out-of-range values are clamped rather than errors. The user's own selection and cursor stay where they were, no events are posted, and it works on locked text areas too - the standard build-log recipe is a locked area you AddTextAreaText into, then colour the error lines.

Formatting styles existing text only - text added later arrives in the default style. SetTextAreaColor changes that default (or the background); SetTextAreaFont changes the face.

Colours set here are kept when the GUI theme changes; in the Light and Dark themes, text you leave uncoloured follows the theme (see SetGuiTheme).

See it working in the tree and text area sample.

Requires Extended mode.

See also: SetTextAreaColor, SetTextAreaFont, TextAreaText, TextAreaChar, AddTextAreaText.

Index