Previous | Contents | Index |
The AT option positions the cursor on the specified row and column. This is the position where the INPUT statement starts the prompt, not where the user enters data.
AT row, col |
row is the row to print at. col is the column to print at. row and col can be any integer numeric constants.
10 CLEAR PRINT AT 1, 1: 20 INPUT AT 3, 10, PROMPT 'Please enter your name: ': name$ 30 PRINT 'Hello '; name$ 40 END RNH (row 3, col 10) | V Please enter your name: Jack Hello Jack |
The ATTRIBUTES option allows input with attributes. The available attributes are:
Multiple attributes used in one INPUT statement are separated by commas.
ATTRIBUTES attr_list |
attr_list contains a list of input attributes.
10 name_attr$ = 'BOLD, UNDERLINE' 20 LINE INPUT 'Enter your name', ATTRIBUTES name_attr$: name$ 30 PRINT 'Hello '; name$ 40 END RNH Enter your name? Susan Hello Susan |
The LENGTH option limits the number of characters that a user can enter. It causes INTOUCH to display underscore characters following the prompt. The number of underscore characters is the length.
LENGTH num_expr |
num_expr is the number of characters the user can enter.
10 INPUT 'Enter your name', LENGTH 15: name$ 20 INPUT 'Enter a city', LENGTH 20: city$ 30 PRINT name$, city$ 40 END RNH Enter your name? Betty__________ Enter a city? 'San Diego'_________ Betty San Diego |
DEFAULT lets you provide defaults for INPUT statements. INTOUCH automatically formats the default appropriately. The user can press [Return] to accept the default you provide.
DEFAULT str_expr |
str_expr is a string expression that will be used as the default. When INTOUCH executes an INPUT statement with a default, it prints the default after the prompt.
10 INPUT 'Enter the state code', DEFAULT 'CA': state$ 20 PRINT 'The state was: '; state$ 30 END RNH Enter the state code? CA The state was: CA |
If the user does not want the default, they can simply type over the default text.
5.11.1 Pre-positioning to a DEFAULT Menu Item
When performing an INPUT MENU, the
DEFAULT option can be used to specify a default menu
path. The default takes the format of:
#item1;#item2;... |
#item1 is the number of the item on the first menu, #item2 is the number of the item on the second menu, and so on.
Upon the completion of a INPUT MENU statement, the concept _STRING contains the menu path taken by the user when selecting the menu item. i.e. #2;#3 means the 3rd item of the 2nd submenu. (For information on menus, see Section 5.17, MENU Option.)
10 CLEAR 20 line1$ = '%WIDTH 12, %MENUBAR, %AUTOVBAR ON,' line2$ = 'file = {new, get_file, save, save_as},' line3$ = 'edit = {cut, copy, paste},' line4$ = 'paragraph = {font, alignment, spacing, tabs, headers, footers},' line5$ = 'options = {ruler = {on, off}, side_bar = {on, off},' line6$ = 'view = {enlarged, normal, small}},exit' 30 test_menu$ = line1$ + line2$ + line3$ + line4$ + line5$ + line6$ the_default$ = '' 40 DO INPUT MENU test_menu$, DEFAULT the_default$: ans$ IF _EXIT THEN EXIT DO MESSAGE 'Menu path was', _STRING the_default$ = _STRING LOOP 50 END |
+------------------------------------------------------------------------------+ | FILE | EDIT | PARAGRAPH | OPTIONS | EXIT | +--------------------------------------------+---OPTIONS---+-------------------+ | RULER [>| | SIDE_BAR +----VIEW-----+ | VIEW | ENLARGED | +-----------| NORMAL | | SMALL | +-------------+ |
The menu path was: #4;#3;#2
5.12 ERASE Option
The ERASE option clears the input line prior to
accepting input. After input has been completed, the input line is
cleared again.
10 CLEAR PRINT AT 1,1: 20 INPUT 'Please enter a name', AT 3,1: name_1$ INPUT 'Enter a 2nd name', AT 4,1, ERASE: name_2$ PRINT '1st name: '; name_1$ PRINT '2nd name: '; name_2$ 30 END RNH Please enter a name? James 1st name: James 2nd name: Tony |
The VALID option validates user responses according to specified validation rules.
VALID str_expr |
str_expr is the list of validation rules.
You can refer to the VALID() function in Appendix A, Built-in Functions for information on all the validation rules.
10 INPUT 'Enter name', LENGTH 20: name$ 20 INPUT 'Enter age', LENGTH 5, VALID 'INTEGER': age$ 30 PRINT name$, age$ 40 END RNH Enter name? Aaron_______________ Enter age? 32___ Aaron 32 |
The TIMEOUT option limits the time the user has to respond to the INPUT prompt. A time limit must be specified with the TIMEOUT option. If the user does not complete the INPUT statement within the specified time, an exception ("timeout on input at xx") is generated.
TIMEOUT num_expr |
num_expr is a numeric expression that represents the number of seconds allowed for the response.
10 INPUT 'Name', TIMEOUT 4.5: name$ 20 END RNH Name? Timeout on input at 10 INTOUCH |
TIMEOUT 30 gives the user approximately 30 seconds to enter a name. Fractions of a second can be indicated by including decimal digits. TIMEOUT 4.5 gives the user approximately 4.5 seconds to enter a name.
5.15 AREA Option
The AREA option does input from an area on the screen.
LINE INPUT AREA top, left, bottom, right: str_expr |
Top | Top row of the area on the screen | |
Left | Left column of the area | |
Bottom | Bottom row of the area | |
Right | Right column of the area |
10 CLEAR 20 MESSAGE 'Press GOLD/F when done' 30 LINE INPUT AREA 5, 10, 8, 60: text$ 40 PRINT AT 10, 1: 'Rewrapped text' 50 wt$ = WRAP$(text$, 1, 30) 60 PRINT wt$ 70 END RNH This is an example of wrapped text. The text is wrapping.__________________________________________ ___________________________________________________ ___________________________________________________ Rewrapped text This is an example of wrapped text. The text is wrapping. |
A BELL is output if user-entered text goes outside the area.
During a LINE INPUT AREA, the following features are available:
While you are entering text in an area, you can use the following commands:
Text | To enter text, just type it. | |
Arrow keys | To move around, press UP, DOWN, LEFT, RIGHT | |
[CTRL/H] | Moves cursor to beginning of line | |
[CTRL/E] | Moves cursor to end of line | |
[GOLD/B] | Moves cursor to the top of the area | |
[GOLD/F] | Complete (finish) and save the input | |
F10 | Exit (abort) the input | |
[CTRL/Z] | Exit (abort) the input | |
[Help] | Exits from the input and sets the variable _HELP to true |
The "back" (\) keystroke has meaning if it is in the first position of the area (top left corner).
When you finish a LINE INPUT AREA, INTOUCH removes any trailing line feeds and spaces.
5.16 SCREEN Option
The SCREEN option is used to create formatted data
entry screens. The SCREEN option lets the user enter data into a
fill-in area.
SCREEN str_expr |
str_expr specifies the screen format.
10 INPUT 'Your name, please': name$ 20 INPUT SCREEN 'Soc. sec.: <DIGITS:###-##-####>': SSN 30 PRINT name$, 'Social security number:'; SSN 40 END RNH Your name, please? John Soc. sec.: ___-__-____ |
When the program executes, INTOUCH displays the prompt "Soc. sec.:" and a fill-in area with underscore characters where the user must fill in a number. The fill-in area is highlighted. As the user enters the social security number, it appears in the fill-in area and the underscores disappear. When the [Return] key is pressed, the number is assigned to the the variable SSN.
RNH Your name, please? John Soc. sec.: 555-48-6662 John Social security number: 555486662 |
You can use the SCREEN option with any data type. A string expression follows the keyword SCREEN. The expression contains any text to print and the format for the fill-in areas.
A number of commands can be used within the format to control how the fill-in area works. These fall into two categories:
Format options come first. They are followed by a colon and then by format characters.
5.16.1 Screen Format Characters
The # is used to specify digits. Wherever a # sign appears, only these types of characters are allowed as input. For example, the # might be used for a phone number:
10 INPUT SCREEN '<:(###) ###-####>': phone 20 PRINT phone 30 END |
When INTOUCH executes this program, it displays the following fill-in area:
(___) ___-____ RNH (555) 554-7879 5555547879 |
The @ is used to specify any printable character, including letters and numbers.
10 INPUT SCREEN 'License #: <@@@ @@@@>': license$ 20 PRINT 'License: '; license$ 30 END RNH License #: INF 5783 License: INF5783 |
A decimal point is used to align the fractional portion of a floating point number. If the screen format is in the form <###.####>, when the user presses the [.] key, the digits will be right-justified to the decimal point. When the field is complete, the digits to the right of the decimal will be left-zero filled.
10 PRINT 'Input .59, please' 20 INPUT SCREEN 'Amount: <###.####>': amt$ PRINT 'Amount = '; amt$ 30 END RNH Input .59, please Amount = .5900 |
The ^ is used to specify an UPPER-CASE letter. If the next character input is a lower-case letter, INTOUCH will change it to upper-case and echo it to the terminal in upper-case.
10 INPUT SCREEN 'First name: <^@@@@@@@@@@@@@>': first$ INPUT SCREEN 'Middle initial: <^>.': middle$ INPUT SCREEN 'Last name: <^@@@@@@@@@@@@@@@>': last$ 20 PRINT first$; ' '; middle$; '. '; last$ 30 END RNH First name: John___________ Middle initial: B. Last name: Smithy___________ John B. Smithy |
The ~ (tilde) is used to specify that any character that follows the ~ will not be replaced.
If you use format options, they must be placed before the format characters and followed by a colon. The following format options are available:
Upper-cases all letters that are typed. If you type a letter in lower-case, it is changed to upper-case and echoed to the terminal screen in upper-case.
10 PRINT 'Type in some text!' 20 INPUT SCREEN '<UCASE:@@@@@@@@@@@@@@@@@@@@>': text$ 30 PRINT 'Here is your text: '; text$ 40 END RNH Type in some text! JOHN B. SMITHY______ Here is your text: JOHN B. SMITHY |
Lower-cases all letters that are typed. If you type a letter in upper-case, it is changed to lower-case and echoed to the terminal screen in lower-case.
10 PRINT 'Type in some text!' 20 INPUT SCREEN '<LCASE: @@@@@@@@@@@@@@@@@@@@>': text$ 30 PRINT 'Here is your text: '; text$ 40 END RNH Type in some text! john b. smithy Here is your text: john b. smithy |
Typed characters are not echoed (printed) on the screen.
10 INPUT SCREEN '<NOECHO:Password? @@@@@>' : pw$ 20 PRINT pw$ 30 END RNH Password? _____ Elene |
Allows only digits to be entered in the field. The format character # also allows the minus sign and the decimal point.
10 INPUT SCREEN 'Phone: <DIGITS:###-####>': phone 20 PRINT phone 30 END RNH Phone: 555-6798 5556798 |
AJ causes INTOUCH to jump automatically to the next field when the current field has been filled in. The field must be completely filled in before INTOUCH will jump to the next field.
10 INPUT SCREEN 'Phone: <AJ, DIGITS:###-####>': phone 20 INPUT SCREEN 'Soc. sec.: <DIGITS:###-##-####>': ssn 30 PRINT phone, ssn 40 END RNH Phone: 555-3839 Soc. sec.: 899-75-3432 5553839 899753432 |
REQ specifies that input is required and you must enter something. The computer will beep and you will be prompted until valid input is entered.
The AT option displays the field on the screen at the row and column position specified. row specifies the row to print at. column specifies the column to print at.
You can supply defaults for each field in the screen. The format of the defaults is a list of values separated with line feeds. Defaults are set up in the following example.
10 city$ = 'St Paul' state$ = 'Minnesota' df$ = city$ + chr$(10) + state$ CLEAR scr$ = '<AT 6, 10: City @@@@@@@@@@@@@@@@@@@@@@@@@@>' & +'<AT 7, 10: State ^^>' INPUT SCREEN scr$, DEFAULT df$: city$, state$ 20 END RNH City St. Paul State Mi |
The VALID option allows full validation of each field on the screen. (See the VALID function in Appendix A for a list of validation rules.) The format of the VALID option is:
VALID 'rule_str' |
rule_str is the list of validation rules. Multiple validation rules are separated by semi-colons.
10 INPUT SCREEN 'code = <VALID "integer":###-##-##>': ans$ PRINT ans$ 20 END RNH code = 121-23-47 1212347 |
The ELAPSED option keeps track of the time it takes the user to respond to an INPUT prompt. INTOUCH assigns the elapsed time to the variable specified. The ELAPSED option starts marking time when INTOUCH finishes displaying the prompt. Time stops when all the variables listed in the INPUT statement have values. The format is:
ELAPSED num_var |
num_var is the numeric variable the elapsed time is assigned to. INTOUCH returns the elapsed time in seconds. If a real numeric variable is specified, INTOUCH returns the time to a hundredth of a second (1/100).
10 INPUT 'Name', ELAPSED x: name$ 20 PRINT name$; ', your elapsed time is'; x 30 END RNH Name? John John, your elapsed time is 1.39 |
If an integer variable is specified, INTOUCH rounds the time to the nearest second.
10 INPUT 'Name', ELAPSED x%: name$ 20 PRINT name$; ', your elapsed time is'; x% 30 END RNH Name? Julie Julie, your elapsed time is 1 |
Previous | Next | Contents | Index |