Blitz3D+ Command Reference

TextAreaText$ ( textarea[,pos][,len][,units] )

Parameters

textarea - text area gadget

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

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

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

Description

Returns text from a text area - all of it by default, or any range.

Requires Extended language mode.

The read half of a text area. With no range arguments it returns the whole contents - what a Save command writes to disk. Give it a range for less: characters for exact spans (the selection, a search hit), or units 2 to speak in lines, where pos is the first line and len how many:

whole$=TextAreaText(area)
oneLine$=TextAreaText(area,5,1,2) ; line 5 only

Positions count whole Unicode characters from 0 - the same positions TextAreaCursor, TextAreaChar and SetTextAreaText use - and line breaks come back as carriage returns (Chr(13)), each counting as one character. Split on that, not on Chr(10).

Out-of-range values are forgiving: everything is clamped to the actual text, and an empty range returns "". Only the plain text is returned - colours and styles applied with FormatTextAreaText are not part of it.

The tree and text area sample and the world editor shell sample show the text area panes this reads from.

See also: SetTextAreaText, AddTextAreaText, TextAreaLen, TextAreaCursor, TextAreaSelLen.

Index