BB___ORIGIN

=ORIGIN= toc

Description
> This command, for use with text windows and texteditors only, either //**returns**// the current column and row of the upper left corner of the window (**!origin?**), or //**places**// the specified column and row in the upper left corner of the window (**!origin**).

Syntax

 * To return col and row**
 * To place col and row**
 * To place col and row**
 * To place col and row**

Hints
>> code format="lb" code >> code format="lb" code
 * 1) //**Origin of origin.**// Origin refers to the upper left corner of the window. The **origin?** of a window when first opened is column 1, row 1. If you wanted to place that position into variables, you could issue this command:
 * 1) handle.ext "!origin? startCol startRow"
 * 1) //**To set position.**// To have the word at column 3, row 7 of your displayed text appear in the upper left corner of the window when it opens, issue this command:
 * 1) handle.ext "!origin 3 7"
 * 1) //**Cursor position.**// The origin command does not reposition the cursor at the specified column and row, except to the extent that the cursor is placed at the upper left corner of the window when it opens. There is no native command to position the cursor in a text window (as can be done with the locate command in the mainwin, for example).

Example
code format="lb" WindowWidth = 300 WindowHeight = 400

texteditor #1.te1 10, 10, 260, 200

open "" for window as #1 #1 "trapclose [quit]" #1 "font Courier 12"

for i = 1 to 10 for j = 1 to 10 #1.te1 j;       next j        #1.te1 " Row "; i    next i

#1.te1 "!origin 3 7"

#1.te1 "!origin? colVar rowVar" print "Col ";colVar, "Row "; rowVar wait

[quit] close #1 end code

Useful Functions
code format="lb" Place a useful function using this keyword here code