To re-route text and graphics:
route [#]_toBuffer [+ 0... 4 ]
To re-route text:
This statement causes text printed by subsequent
print statements to be sent to the indicated device. If you specify
_toPrinter, subsequent drawing commands are also sent to the indicated device. If you specify
_toBuffer, only text printing commands are sent to the indicated device.
Using route _toPrinter
route _toPrinter opens a new print job unless a print job is already open. When you first open a new print job, the printer adopts the font and graphics characteristics that are in effect in the current screen window. Subsequent
print statements, as well as graphics commands such as
plot, are sent to the printer. Subsequent statements which affect the appearance of text and graphics, such as
color, apply to the printed output. Subsequent QuickDraw Toolbox commands such as
FrameRect apply to the printed output.
Note: To actually put out the current printer page, use the
clear lprint statement after sending text and drawing commands to the printer.
Using route _toScreen
route to direct output to the printer, or to a serial device or a file, you can use
route _toScreen to re-direct output back to the screen window again.
Note: Statements which affect the appearance of text and graphics, such as
color, apply separately to the screen window and to the printer. The settings in one device don't affect the settings in the other, except when you first open a new print job.
Using route serialPort and route fileID
These statements cause text printed by subsequent
print statements to be sent to the specified open device. They don't affect the destination of graphics commands. This group of statements:
has the same effect as this group of statements:
print #deviceID, itemList1
print #deviceID, itemList2
print #deviceID, itemListN
Using route _toBuffer
You can use the FutureBasic
route _toBuffer statement to print information directly to a handle. You may use any one of five handles by setting the route statement in the range of
_toBuffer + 4. When routed to a buffer, only text commands are sent to the handle. Graphic commands are ignored.
Information printed to a buffer ends up in one of five handles stored as globals in the FutureBasic runtime. This array is named
n is a numeric expression in the range of 0...4. The following example prints text to buffer number 2.
route _toBuffer + 2
When this snippet has been executed,
gFBbuffer(2) will contain a handle that points to a moveable block of 14 bytes:
Note that carriage returns are added or suppressed in writing to a buffer just as they would be in writing to a file or to the screen.
If you want to dispose of a buffer, use
window statement and the
window output statement implicitly execute a
route _toScreen statement. Also, any user action which activates a screen window (such as clicking on its title bar) will implicitly cause a
route _toScreen. If you want to make sure that output is not inadvertently directed to the screen window, you should check for
_wndActivate events in your dialog-event handling routine, and re-direct the output as necessary.
open; print; print#; clear lprint; close lprint; text; pen; color; long color; box; circle; plot; on dialog