TextAreaLine ( textarea,char )
Parameters
|
textarea - text area gadget char - character position, starting at 0 |
Description
|
Returns the line number that contains a character position of a text area. Requires Extended language mode. The bridge from range-based thinking back to lines - the inverse of TextAreaChar. Character positions count whole Unicode characters from 0, the same positions TextAreaCursor, TextAreaText and SetTextAreaText use; lines count from 0 as well. The classic use is a status bar that tracks the caret in a script or notes pane: line=TextAreaLine(area,TextAreaCursor(area)) SetStatusText window,"Line "+(line+1) (TextAreaCursor(area,2) gets the same line directly; TextAreaLine earns its keep when the position came from somewhere else - a saved bookmark, a search result.) Out-of-range positions are forgiving: 0 or below maps to line 0, and a position past the end maps to the last line. The tree and text area sample shows the text area family working together. See also: TextAreaChar, TextAreaCursor, TextAreaLineLen, TextAreaLen. |
Index