72
HORIZONTAL AND VERTICAL TABS
Suppose you need to move across the page to a certain position several times in a document. It’s not much fun to type in space after space. You don’t have to - you can “tab” your way across the page.
Your printer’s tabs are like those on a typewriter, but much more powerful. You have both horizontal and vertical tabs which can be used for both text and graphics - and they’re really handy for indenting paragraphs and making tables.
nHorizontal tabs
Horizontal tabs are set automatically every eight positions. To move the print head to the next tab position, send CHR$(9).
Try this program to see how the default tabs work.
10 ’ | Demo of horizontal | tabbing | ||
20 LPRINT "ONE";CHR5(9);"TWO";CHR$(9);"~REE"; | ||||
CHR5(9) ;"FOUR" |
|
|
| |
Here’s what you should get - |
| |||
r.:lp]k: | .‘rLA]0 | F:‘ij!J~C; |
Even though the words are different length, they are spaced out evenly by the horizontal tabs.
Now add the following line to your program to set different horizontal tabs:
15 LPRINT CHR5(27);"D";CHR$(7);CHR5(14);CHR5(21); CHR$(O);
<ESC > “D” is the command to begin setting horizontal tabs. It must be followed by characters representing the po- sitions where you want the tabs set. In our program we are setting tabs in columns 7, 14, and 21. The final CHR$(O) ends the string of tabs. In fact, any character that is not greater than the previous one will stop setting tabs. This means that you must put all your tab values in order, from least to greatest, or they won’t all get set.