This operation code allows you to change the position of the printer's write cursor. This is useful when doing multiple write statements that include a variety of fonts, font sizes, and font attributes.
CALL "WIN$PRINTER" USING WINPRINT-SET-CURSOR, WINPRINT-DATA GIVING RESULT
WINPRINT-DATA | Group item defined in
winprint.def as follows:
01 WINPRINT-DATA. 03 WPRTDATA-SET-STD-FONT. 03 WPRTDATA-DRAW REDEFINES WPRTDATA-SET-STD-FONT. 05 WPRTDATA-DRAW-START-X PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-START-Y PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-STOP-X PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-STOP-Y PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-UNITS UNSIGNED-SHORT. 05 WPRTDATA-DRAW-SHAPE UNSIGNED-SHORT. |
This option returns the horizontal and vertical coordinates of the write cursor. If an error is returned, the current cursor position is not affected.
When printing in Windows, the position of text on the printed page is determined by the location of the write cursor. This is usually handled automatically by the runtime, but you may use this operation to position the cursor yourself.
The printer must be open to perform this operation. WPRTDATA-DRAW should be initialized prior to use. The current cursor position on the printer is modified by this call only if WPRTDATA-DRAW-SHAPE is set to a value of 0 and the operation is successful. When the cursor is moved in this manner, subsequent WRITE statements will be affected. One exception is that the vertical position of subsequent calls to WINPRINT-COLUMNS will be altered, but not the horizontal position.
If you use this operation with WPRDATA-DRAW-SHAPE set to a non-zero value, the cursor is not repositioned. This can be used to inquire the position of the write cursor without changing it. There is no limit to the number of times this operation may be called.
WINPRINT-SET-CURSOR has the following values:
WPRTUNITS-CELLS | Values are measured using the
cell size of the currently selected font. The cell-size is determined by the height and width of the
0 character of a font. This is roughly equivalent to measuring in
characters.
Positioning is relative to the individual printer's physical margin. Please note that the margin set in WINPRINT-SET-MARGINS is not used to determine the cursor position. If you use a proportional font, it is common for uppercase characters to be wider than this measurement. Non-integer values are allowed in the measurements. |
WPRTUNITS-CELLS-ABS | Values are measured using the cell size of the currently selected font. Positioning is based on the left edge of the paper, regardless of the physical left margin determined by the printer (even if the absolute position is smaller). If the dimensions of the area to be printed are less than the printer's left or top physical margin, or greater than the printer's right or bottom physical margin, WIN$PRINTER will return an error. (Note that due to inherent differences in the hardware of printer manufacturers, this value may not provide truly device-independent results.) |
WPRTUNITS-INCHES | Values are measured in inches. Positioning is relative to the individual printer's physical margin. Please note that the margin set in WINPRINT-SET-MARGINS is not used to determine the cursor position. |
WPRTUNITS-INCHES-ABS | Values are measured in inches. Positioning is based on the left edge of the paper, regardless of the physical left margin determined by the printer (even if the absolute position is smaller). If the dimensions of the area to be printed are less than the printer's left or top physical margin, or greater than the printer's right or bottom physical margin, WIN$PRINTER will return an error. |
WPRTUNITS-CENTIMETERS | Values are measured in centimeters. Positioning is relative to the individual printer's physical margin. Please note that the margin set in WINPRINT-SET-MARGINS is not used to determine the cursor position. |
WPRTUNITS-CENTIMETERS-ABS | Values are measured in centimeters. Positioning is based on the left edge of the paper, regardless of the physical left margin determined by the printer (even if the absolute position is smaller). If the dimensions of the area to be printed are less than the printer's left or top physical margin, or greater than the printer's right or bottom physical margin, WIN$PRINTER will return an error. |
WPRTUNITS-PIXELS (default) | Values are measured using the dots-per-inch (DPI) resolution of the output device. Only integer values are allowed in the
measurements. Positioning is relative to the individual printer's physical margin. Please note that the margin set in WINPRINT-SET-MARGINS
is not used to determine the cursor position.
The actual size of this measurement varies depending on the target printer's resolution. This means that a coordinate of 5 will appear in a different location on a 300dpi printer than it will on a 600dpi printer. Consider the unit of measure relative to the resolution of the targeting printer before printing. |