Using tabs
The Print function has several formats. The format shown on
the preceding page prints a string starting at the left edge of
the print area and then prints a new line. In other formats of the
Print function, you can use tabbing to specify the print cursor
position before or after printing, or both.
Specifying tab values
Tab values are specified in thousandths of an inch and are
relative to the left edge of the print area. If a tab value precedes
the string in the Print call and no tab value follows the string, PowerBuilder tabs,
prints, and then starts a new line. If a tab value follows the string, PowerBuilder tabs
after printing and does not start a new line; it waits for the next
statement.
In these examples, Job is the integer print job number.
This statement tabs one inch from the left edge of the print
area, prints Atlanta, and starts a new line:
1 |
Print(Job,1000,"Atlanta") |
This statement prints Boston at the current print position,
tabs three inches from the left edge of the print area, and waits
for the next statement:
1 |
Print(Job,"Boston",3000) |
This statement tabs one inch from the edge of the print area,
prints Boston, tabs three inches from the left edge of the print
area, and waits for the next statement:
1 |
Print(Job,1000,"Boston",3000) |
Tabbing and the print cursor
When PowerBuilder tabs, it sets the x coordinate of the print
cursor to a larger print cursor value (a specified value or the
current cursor position). Therefore, if the specified value is less
than the current x coordinate of the print cursor, the cursor does
not move.
The first Print statement shown below tabs one inch from the
left edge of the print area and prints Sybase, but it does not move
to the next tab (.5 inches from the left edge of the print area
is less than the current cursor position). Since a tab was specified
as the last argument, the first Print statement does not start a new
line even though the tab was ignored. The next Print statement prints
Inc. immediately after the e in Sybase (Sybase Inc.) and then starts
a new line:
1 |
Print(Job,1000,"Sybase",500) |
1 |
Print(Job," Inc.") |