Function DevPos() Foundation

Positions the cursor or print head.

Syntax
DevPos(<nRow>, <nCol>) --> NIL
Parameters
<nRow>
<nRow> is the new row position for the cursor or print head.
<nCol>
<nCol> is the new column position for the cursor or print head.
Return

The return value of DevPos() is always NIL.

Description

The environment function DevPos() positions the cursor or the print head depending on whether the screen or the printer is defined as the current output device. Generally the screen is the output device. In this case DevPos() behaves like the function SetPos(). The cursor is moved to the indicated position and Row() and Col() are updated with the new cursor position.

When the printer is defined as the output device with SET DEVICE, DevPos() positions the print head instead. The necessary number of positioning characters (Line-feed (Chr(10)) and/or Form-feed (Chr(12))) are sent to the printer in order to bring the print head to the specified position. When the print margin is defined as greater than zero with SET MARGIN, this value is added to <nCol>. The print head is moved to the specified position <nRow> and <nCol>, and PRow() and PCol() are updated. When <nRow> or <nCol> is smaller than the current value of PRow() or PCol(), the print head is moved according to the following rules:

If <nRow> is less than PRow(), a form feed (Chr(12)) is automatically sent to the printer (which corresponds to the command EJECT). Then enough line feeds (Chr(10)) are sent to move the print head to <nRow>.

If <nCol> plus the value of SET MARGIN is less than PCol(), a carriage return (Chr(13)) and the number of blank spaces required to position the print head at <nCol> are sent to the printer.

This default behavior is suppressed when PRow() and PCol() are set back to new values with the function SetPrc() before the function DevPos() is called. There is further discussion of this in the section on the function SetPrc().

If the print output is being sent to a file with the command SET PRINTER, DevPos() updates the file instead of the print head position.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.