Futurebasic/Language/Reference/print
Syntax
editPRINT [@(col,row)|%(h,v)][printItem [{,|;}[printItem]...]]
PRINT [@(col,row)|%(h,v)][POINT [{,|;}[POINT]...]]
Revised
editMay 5, 2000 (Release 3)
Description
editUse this statement to put text out to the current window or to the currently ROUTE
'd device. The text is printed using the window's or printer's current font ID, font size, text style, text mode and foreground color (see the TEXT
, COLOR
and LONG COLOR
statements). The parameters are interpreted as follows:
When the item to be printed is a point, FB makes special provisions during the print process.
DIM mousePos AS POINT
CALL GETMOUSE(mousePos)
PRINT mousePos
The output looks like this (194x,167y)
¥ @(col,row)|%(h,v)
This specifies where the first printed character should appear within the window or the printed page. If you use the @(col,row)
variant, then col
and row
represent the text column and row where the first character should appear; the exact pixel location depends on the current font ID and font size. If you use the %(h,v)
variant, then h
and v
represent horizontal and vertical pixel positions; the first printed character is positioned with its lower-left corner at point (h,v)
. If you don't specify either variant, printing begins at the window's or printer's current pen position.
¥ printItem
This can be any of the following:
"Image Was Here
¥ {,|;}
You must use a comma or a semicolon to separate each pair of printItem
's; you can also optionally put a comma or semicolon at the end of the PRINT
statement (following the last printItem
).
A comma causes space characters to be printed until the total number of characters on the line is a multiple of the current "tab field width." The default tab field width is 16; you can set it to other values using the DEF TAB
statement. Commas are usually used to help line up several lines of text into neat columns, or just to put some space between consecutive printItem
's.
A semicolon does not cause any spaces to be inserted between consecutive printItem
's. Use this when you want printItem
's to be printed as close together as possible.
Normally, PRINT
moves the pen down to the beginning of the next line after the last printItem
is printed. However, if you put a comma or a semicolon at the end of the PRINT
statement, the pen remains to the right of the last printItem
, and is not moved down to the next line. This allows you to continue printing on the same line using a subsequent PRINT
statement.
Note that you can use PRINT
without any parameters, like this:
PRINT
This simply causes the pen to move down to the beginning of the next line; it effectively "prints" a carriage-return character. This is useful for putting blank line(s) between other lines of text.
Line wrap, scrolling and page-eject
By default, if the printItem
's reach the right edge of the window or the printer page, the PRINT
statement automatically "wraps the line"; that is, it moves the pen down to the beginning of the next line to continue printing the remaining printItem
's. However, this behavior can be altered using the WIDTH
statement; see the <a href="width.html">WIDTH</a>
statement for more information.
If you're printing to a window, and the PRINT
statement causes the pen to move below the bottom of the window, the window's contents are scrolled up so that the newly printed text will be visible.
If you're printing to the printer, and the PRINT
statement causes the pen to move below the bottom of the printer page, the page is ejected and printing continues at the top of the next page.
FB Lite behavior:
When you use the "FB Lite" runtime, PRINT
behaves as follows:
- The [
@(col,row)
] parameters are ignored. PRINT
switches to the Text Window before printing (unless output has been routed to the printer orPRINT%
is used). You can usePRINT%
to display text in the Graphics Window at an exact pixel position. Text printing will continue in the graphics window until a carriage return is encountered. You may suppress carriage returns using the semicolon character.- The
WIDTH
statement has no effect.PRINT
always wraps the line at the right edge of the window (or the printer page).
Note:
Text which is displayed using the PRINT
statement is not automatically refreshed, unless you're using the "FB Lite" runtime. To display text which is automatically refreshed, consider using Edit Fields (see the <a href="edit%20field.html">EDIT FIELD</a>
statement).
See Also
editTEXT; COLOR; LONG COLOR; WIDTH ;DEF TAB; USING; SPACE$; EDIT FIELD