If a separator (comma, semicolon, TAB function or AT option) is the last item in the PRINT statement, INTOUCH advances the cursor to the position specified and does not generate a new line.
10 PRINT TAB(5); 7, PRINT 10; PRINT 20 20 END RNH 7 10 20
The video attribute options highlight text on the screen. Separate the options from the print list with a colon. The options are:
BLINK | causes the expressions in the print list to blink in low and high intensity | |
UNDERLINE | causes the print list to be underlined | |
BOLD | causes the expressions in the print list to appear in bold (high intensity) | |
REVERSE | causes the print list to appear in reverse video |
The video options can be combined. For example, the following program will print "Hello" boldfaced and in reverse video. It will then blink and underline the word "Goodbye".
10 PRINT BOLD, REVERSE: 'Hello' 20 PRINT UNDERLINE, BLINK: 'Goodbye' 30 END
The USING option is used to format text. The print mask indicates the format for the data in the print list.
USING print_mask
The print_mask consists of fields or directives and text. The text can precede or follow a field or directive. The print mask tells how to print the expressions in the print list.
fields / \ 10 LET a$ = "#.## ##.##" 20 PRINT USING "amount = #.##": 1.9 30 PRINT USING a$: 1.93, -1.93 40 END RNH amount = 1.90 1.93 -1.93
Expressions in the print list with the USING option are separated by commas. A trailing semicolon is allowed. The expressions are printed according to the the format. However, a trailing semicolon causes INTOUCH to leave the cursor at the end of the print line.
10 PRINT USING "###.## ###.##": 22.88, 45; 20 PRINT " and others." 30 END RNH 22.88 45.00 and others.
Fields are made up of format characters. The format characters tell INTOUCH how to print the expressions in the print list.
6.1.10.1 String Format Characters
The # is used to indicate a character position---a place in the format where a character can occur. For example:
10 PRINT USING '#### ##': 'Test', 'Hi' 20 END RNH Test Hi
In the above example, there are two fields. When the first string is printed, the word "Test" occupies all four character positions. When the second expression is printed (Hi), only two character positions are used.
If the string expression being printed is smaller than the field, the expression will be printed centered within the field.
10 PRINT USING '#### ####': 'Test', 'Hi' 15 PRINT '123456789' 20 END RNH Test Hi 123456789
If the string expression is longer than the field, INTOUCH generates an exception.
6.1.10.2 Numeric Format Characters
The # can also be used to specify digits. Each # represents one numeric digit position.
10 PRINT USING "##": 19 20 END RNH 19
If you indicate more positions than the numeric expression contains, the expression will be right-justified and padded with spaces.
10 PRINT '1st 2nd 3rd' 20 PRINT USING "### ### ###": 193, 19, 1 30 END RNH 1st 2nd 3rd 193 19 1
INTOUCH prints a minus sign in front of negative numbers. INTOUCH does not print a sign in front of positive numbers.
10 PRINT '1st 2nd 3rd' 20 PRINT USING "### ### ###": 193, 19, -1 30 END RNH 1st 2nd 3rd 193 19 -1
If you indicate more positions to the left of the decimal point than the expression contains, the expression will be printed with leading spaces.
10 PRINT USING "###.##": 1.9 20 END RNH 1.90
If you indicate more positions to the right of the decimal point than the expression contains, the expression will be printed with trailing zeros.
10 PRINT '--1-- --2--' 20 PRINT USING "##.## ##.##": 1.3, 1.25 30 END RNH --1-- --2-- 1.30 1.25
The less than sign left-justifies text within a field. The less than sign must appear at the beginning of a field. The less than sign counts as a character position. In this example, justification occurs only in the second field.
10 PRINT USING "#### <###": 'Test', 'Hi' 20 PRINT '123456789' 30 END RNH Test Hi 123456789
In the above example, there are two fields. When the first string is printed, the word "Test" occupies all four character positions. The less than sign (<) causes INTOUCH to left-justify the second expression.
The greater than sign is used to right-justify text within a field. The greater than sign must appear at the beginning of a field. The greater than sign counts as a character position.
10 PRINT USING "#### >###": 'Test', 'Hi' 20 PRINT '123456789' 30 END RNH Test Hi 123456789
In the above example, there are two fields. The greater than sign (>) causes INTOUCH to right-justify the second expression.
The @ indicates one character position with no translation.
10 PRINT USING '####': 0001 20 PRINT USING '@@@@': 0001 30 END RNH 1 0001
You can include a decimal point in a number by putting a period or decimal point in the format.
10 PRINT USING "###.##": 19.3 20 END RNH 19.30
You can include commas in your numbers by putting commas in the format.
10 a$ = "##,###.##" 20 PRINT USING a$: 28290.06 PRINT USING A$: 8290.06 PRINT USING A$: 290.06 30 END RNH 28,290.06 8,290.06 290.06
Commas cannot be used in exponential format.
The % character pads on the left with zeros.
10 PRINT '-1- -2- -3-' PRINT USING "%%% %%% %%%": 193, 19, 1 20 END RNH -1- -2- -3- 193 019 001
The * character pads on the left with asterisks. You can use this symbol for setting up check amounts.
10 PRINT USING '***,***.**': 19.42 20 END RNH *****19.42
If the expression is smaller than the format, INTOUCH will right justify the expression and pad it with asterisks.
10 PRINT '-1- -2- -3-' PRINT USING "*** *** ***": 193, 19, 1 20 END RNH -1- -2- -3- 193 *19 **1
A plus sign causes INTOUCH to print a leading plus or minus sign. INTOUCH will print a plus sign in front of positive numbers and a minus sign in front of negative numbers.
The "+" sign adds a character position to the format. The character position is used for the sign of the number.
10 PRINT ' -1- -2- -3-' PRINT USING "+### +### +###": 193, 19, -1 20 END RNH -1- -2- -3- +193 +19 -1
Prints a leading or trailing minus sign for negative numbers, and a leading space for positive numbers. The "-" adds a character position to the format. The character position is used to print the minus sign or space.
10 PRINT ' -1- -2- -3-' PRINT USING "-### -### -###": 193, 19, -1 20 END RNH -1- -2- -3- 193 19 -1
Prints a floating dollar sign. The dollar sign appears before the number. $ causes INTOUCH to print '$-' for negative numbers and '$' for positive numbers. The minus sign appears immediately after the dollar sign and before the number.
10 PRINT "1st col 2nd col" PRINT USING "$###.## $###.##": 11.93, -1.93 20 END RNH 1st col 2nd col $11.93 $-1.93
Prints a floating dollar sign. The dollar sign appears before the numeric expression. $+ causes INTOUCH to print a minus sign before negative numbers, and a plus sign before positive numbers.
The sign appears after the dollar sign and before the number.
10 PRINT "1st col 2nd col" PRINT USING "$+###.## $+###.##": 11.93, -1.93 20 END RNH 1st col 2nd col $+11.93 $-1.93
Prints a floating dollar sign. The dollar sign appears immediately before the numeric expression. -$ causes INTOUCH to print a minus sign before negative numbers and a space before positive numbers. The minus sign or space appears immediately before the dollar sign.
10 PRINT "1st col 2nd col" PRINT USING "-$###.## -$###.##": 11.93, -1.93 20 END RNH 1st col 2nd col $11.93 -$1.93
+$ causes INTOUCH to print a floating dollar sign. The dollar sign appears immediately before the number. +$ causes INTOUCH to print a plus sign before positive numbers and a minus sign before negative numbers. The plus or minus sign appears immediately before the dollar sign.
10 PRINT "1st col 2nd col" PRINT USING "+$###.## +$###.##": 11.93, -1.93 20 END RNH 1st col 2nd col +$11.93 -$1.93
Notice that +$ adds two character positions to the format. One position contains the dollar sign, the other contains the plus or minus sign.
Prints a floating dollar sign. The dollar sign appears before the number. $- causes INTOUCH to print a minus sign before negative numbers and a space before positive numbers. The minus sign or space appears after the dollar sign and before the number.
10 PRINT "1st col 2nd col" PRINT USING "$-###.## $-###.##": 11.93, -1.93 20 END RNH 1st col 2nd col $ 11.93 $-1.93
If your expression is too large to fit in a field, INTOUCH gives an exception.
The directives used with the USING option of the PRINT statement tell INTOUCH what to do with the text.
PRINT USING 'directive' : str_expr
The UCASE directive converts the str_expr to upper-case characters.
10 PRINT USING '{UCASE}?' : 'march' 20 END RNH MARCH
The LCASE directive converts the str_expr to lower-case characters.
10 PRINT USING '{LCASE}?' : 'MARCH' 20 END RNH march
The HYPHEN directive causes INTOUCH to suppress the hyphen character if it is the last non-blank character after the format is applied.
10 PRINT USING '<#####~-####' : '92123' PRINT USING '{HYPHEN}<#####~-####' : '92123' 20 END RNH 92123 - 92123
Given a str_expr that contains a date in the format YYMMDD or CCYYMMDD, the DATE directive converts the str_expr to a default or specified, optionally-masked, date format.
These date arguments can be used: YMD, CYMD, MDY, MDCY, DMY, DMCY, DMONY, DMONCY, MONTHDY, MONTHDCY. If no argument is provided, the default is MDCY. (See FORMAT$(expr, str_expr) for examples of date argument usage.)
To format the resulting date, replace the ? with a print mask.
10 PRINT USING '{DATE}?': '950401' PRINT USING '{DATE DMY}?': '950401' PRINT USING '{DATE DMCY}?': '950401' PRINT PRINT USING '{DATE MDY}?': '19950215' PRINT USING '{DATE MDY}##/##/##': '19950215' PRINT USING '{DATE MDCY}##/##/####': '19950215' 20 END RNH 04011995 010495 01041995 021595 02/15/95 02/15/1995
The ROTATE directive rotates the last n characters in a str_expr to the first position in the str_expr. Optionally, the resulting str_expr can be masked by replacing the ? with a print mask.
10 PRINT USING '{ROTATE 3}?': '5552527800' PRINT USING '{ROTATE 3}###~ ###~-####': '5552527800' PRINT PRINT USING '{ROTATE 5}?': 'TuneTommy' PRINT USING '{ROTATE 5}#####~ ####': 'TuneTommy' 20 END RNH 8005552527 800 555-2527 TommyTune Tommy Tune
Given a str_expr containing a 4 digit time in HHMM or HH:MM format or a 6 digit time in HHMMSS or HH:MM:SS format, the TIME directive converts the str_expr to HH:MM AM/PM or HH:MM:SS AM/PM.
10 PRINT USING '{TIME}?': '1022' PRINT USING '{TIME}?': '19:45' PRINT PRINT USING '{TIME}?': '102255' PRINT USING '{TIME}?': '19:45:36' 20 END RNH 10:22 AM 07:45 PM 10:22:55 AM 07:45:36 PM
Given a str_expr containing a 5, 6 or 9 digit zipcode, the ZIPCODE directive converts the str_expr to an appropriate zipcode format.
10 PRINT '5 character zipcode : '; PRINT USING '{ZIPCODE}?': '92126' PRINT '6 character zipcode : '; PRINT USING '{ZIPCODE}?': 'K8A3P9' PRINT '9 character zipcode : '; PRINT USING '{ZIPCODE}?': '931327845' 20 END RNH 5 character zipcode : 92126 6 character zipcode : K8A 3P9 9 character zipcode : 93132-7845
INTOUCH has several features that allow you to control the appearance of the screen. The FRAME ON and FRAME OFF commands discussed previously turn the INTOUCH frame on and off. The statements described in the following sections can be used, within your program, to manipulate the screen.
The MESSAGE statement prints a message at line 23 (the default line) on the screen. When the INTOUCH frame is on, line 23 is within the lower frame.
MESSAGE [ERROR: | DELAY:] expr [; | , expr]
10 CLEAR PRINT AT 1,1: 20 DO MESSAGE 'Enter EXIT to exit' INPUT 'Please enter your name': name$ IF _EXIT THEN MESSAGE 'The End' EXIT DO ELSE PRINT name$ REPEAT DO END IF END DO 30 END RNH Please enter your name? Enter EXIT to exit (first message) Please enter your name? Tester Tester Please enter your name? exit The End (second message)
INTOUCH uses the message line (defaults to line 23) to display messages and errors. You can use the MESSAGE statement to display your own messages and errors on this line.
When the INTOUCH frame is on, your messages will appear within the lower frame. The MESSAGE statement can print several items. Each item can be any INTOUCH numeric or string expression. Multiple items must be separated with a comma or a semicolon. The separator determines where the next expression will be printed.
Semicolons
Separating message items with a semicolon causes the items to immediately follow one another. When the items are printed, no spaces appear between the items.
Commas
Separating items with a comma puts a space between each item.
INTOUCH would display this message:
MESSAGE 'number is', 123; 456; 789
as:
number is 123456789
INTOUCH displays a message for at least three seconds before clearing the message. When the ERROR option is used, INTOUCH rings the device's bell, purges typeahead and displays the message. (Typeahead is the feature that accepts characters typed ahead of the computer's request for input.)
MESSAGE ERROR: expr [; | , expr]
10 CLEAR PRINT AT 1,1: INPUT 'Enter your age': age$ MESSAGE ERROR: 'Is this really your age?' 20 END RNH Enter your age? 99 Is this really your age?
The DELAY option of the MESSAGE statement causes INTOUCH to set an automatic delay, giving the user time to view the message before clearing the message. Starting with a minimum delay of approximately three seconds, INTOUCH increases the delay a little for lengthier messages.
MESSAGE DELAY: expr [; | , expr]
10 CLEAR z$ = 'This is a very, very, very, very, very, very long message' MESSAGE DELAY: z$ MESSAGE DELAY: 'Short message' 20 END RNH This is a very, very, very, very, very, very long message Short message
DELAY [num_expr]
10 PRINT 'Waiting a bit' 20 DELAY 4.5 30 PRINT 'Done' 40 END RNH Waiting a bit Done
Use DELAY when you need to cause a timed delay before continuing program execution---for instance, to give the user time to read a message before clearing the screen.
DELAY causes INTOUCH to pause for the specified number of seconds before continuing program execution. The numeric expression, num_expr, does not have to be a whole number, you can use fractions. For example:
DELAY 3.5
If num_expr is omitted, INTOUCH prints this message at the bottom of the screen:
Press the RETURN key to continueand waits for the user to respond.
If, at the "Press RETURN..." prompt, a user enters:
Ctrl/Z | _EXIT is set to TRUE (1) | |
\ or UP-arrow | _BACK is set to TRUE (1) | |
Help | _HELP is set to TRUE (1) |
The CLEAR statement can be used to clear the INTOUCH screen (everything within the INTOUCH frame) or to clear a specific area of the screen. CLEAR can be used to clear any rectangular area within the frame. When the INTOUCH frame is off, the entire screen can be manipulated with the CLEAR statement. CLEAR always removes messages, even if they are in the frame. You can use this statement to clear the screen before executing code or printing information on the screen.
CLEAR [AREA [BOX] [, attr_list:] row_1, col_1, row_2, col_2]
10 CLEAR INPUT 'Please enter your name': name$ PRINT 'Hello, '; name$ 20 END RNH Please enter your name? Tester Hello, Tester
CLEAR, by itself, clears all text from the screen. CLEAR does not remove the INTOUCH frame if the frame is on, however, it does remove any message text that is displayed within the frame. If the frame is on, INTOUCH positions the prompt within the frame.
The AREA option clears a specific section of the screen. The cleared area is rectangular in shape.
row specifies a vertical position on the screen. Rows are numbered sequentially from the top of the screen to the bottom. With the INTOUCH frame on, there are typically 19 rows. With the frame off, there are usually 24 rows (The number of rows can vary depending on the terminal type and setting.)
col specifies a column--a horizontal position on the screen. Columns are numbered sequentially from the first character position on the left of the screen to the last character position on the right of the screen. Usually there are either 80 or 132 columns (depending on the terminal setting).
columns / \ / \ 1 2 3 4 5 6 7 8 9 ... row 1 ------ | | | | | | | | | | | | | | --------------------------- row 2 ------ | | | | | | | | | | | | | | --------------------------- row 3 ------ | | | | | | | | | | | | | | . . .
Two coordinates must be specified. These coordinates mark opposite corners of a rectangular area. INTOUCH clears the rectangular area specified by these two coordinates. For instance, the statement CLEAR AREA 2,3,8,20 would clear a rectangular area:
1st coordinate (2,3) +----------------+ | | | | | | | | | | +----------------+ (8,20) 2nd coordinate
The first coordinate (2,3) indicates the upper-left corner. The second coordinate (8,20) indicates the lower-right corner.