Futurebasic/Language/Reference/pos

From Wikibooks, open books for an open world
Jump to navigation Jump to search

POS[edit | edit source]

Syntax[edit | edit source]

numCharacters = POS(deviceType)

Description[edit | edit source]

This function returns a number which means different things depending on the value of deviceType. Use one of the following values for deviceType.

¥ _anyDev
POS(_anyDev) returns information about the number of characters sent by the PRINT statement to screen windows or to the device specified by the most recent ROUTE statement. The value of POS(_anyDev) is incremented whenever you print a character (other than a carriage-return) to any open window or to the ROUTE'd device. The value of POS(_anyDev) is reset to zero whenever any of the following happens:

  • You send a carriage-return character to any window or ROUTE'd device (this is usually the final character sent by a PRINT statement); or:
  • The text in any window or ROUTE'd device reaches the right margin and wraps around to the next line; or:
  • You open a new window with the WINDOW statement; or:
  • You start a new print job with the ROUTE _toPrinter statement.

Note[edit | edit source]

POS(_anyDev) often, but not always, represents the number of characters on the current line of text. However, because FB does not maintain separate POS values for separate windows, the value returned by POS(_anyDev) may represent the characters on a line in the current window, or on a line in a different window, or even the sum of the characters on lines in multiple windows.

¥ _printerDev
POS(_printerDev) returns the number of characters printed so far on the current line of text sent to the printer. The value of POS(_printerDev) is incremented whenever you send a chacter[check spelling] (other than carriage-return) to the printer; the value is reset to zero whenever you send a carriage-return character to the printer, or the text reaches the right margin and wraps around to the next line.

¥ _diskDev
POS(_diskDev) returns information about characters sent to open files. The value of POS(_diskDev) is incremented whenever you send a character (other than carriage- return) to any open file; the value is reset to zero whenever you send a carriage-return character to any open file. Note that if you have more than one file open, the value returned by POS(_diskDev) reflects the sum of the characters sent to all the files you're writing to. If you write a total of more than 32767 characters (to all open files) without writing a carriage-return character, the number returned by POS(_diskDev) is invalid.

Note:>
To determine the current horizontal pen position (in pixels), use the WINDOW(_penH) function.

See Also[edit | edit source]

CSRLIN; WIDTH; PAGE function; WINDOW function