Previous | Contents | Index |
CLEAR, by itself, clears all text from the screen. It removes any message text that is displayed within the screen.
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. The default setting for number of rows is 30.
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. The default setting of columns is 80.
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. Sheerpower 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.
Example 7-51 CLEAR AREA |
---|
clear area reverse: 5, 10, 11, 60 print at 7, 20: 'Cleared area is in reverse video' end - - - - - - - - - - - - - - - - - | | Cleared area is in reverse video | | | | - - - - - - - - - - - - - - - - - |
CLEAR AREA allows the following attributes to be used when clearing an area: BOLD, BLINK, REVERSE. Multiple attributes used in one statement are separated by commas.
The BOX option creates an empty box with a frame.
The BOLD, BLINK, and REVERSE attributes can also be used with the BOX option. Separate attributes in one statement with commas.
CLEAR AREA BOX [, attr_list:] row_1, col_1, row_2, col_2 |
Example 7-52 CLEAR AREA BOX - BOLD, BLINK, REVERSE Attributes |
---|
clear area box, bold: 5, 10, 11, 60 print at 7, 20: 'Inside the box' print at 12, 1: 'Outside the box' end +-------------------------------------------------+ | | | Inside the box | | | | | | | +-------------------------------------------------+ Outside the box |
This chapter describes the various ways that data can be entered at the pc and stored into variables.
[line] input var, var... [key] [line] input [ ['Prompt_text'] [, prompt str_expr] [, erase] [, at row, column] [, length num_expr] [, default str_expr] [, VALID str_expr] [, timeout time_limit] [, elapsed num_var] [, area num_expr, num_expr, num_expr, num_expr] [, attributes attr_list] [, screen '[text] <format>...'] [, dialogbox str_exp,] [, menu str_expr: str_var] :] var [,var. . .] |
Example 8-1 INPUT Statement |
---|
input 'Please enter your first name': first$ input 'Now, enter your last name': last$ line input 'Where do you live': city$ print print 'Hello '; first$; ' '; last$ print 'From '; city$ end Please enter your first name? Sunny Now, enter your last name? Day Where do you live? San Diego, California Hello Sunny Day From San Diego, California |
The INPUT statement is used to ask questions from the user and store the answers for use in a program.
The INPUT statement reads data typed by the user and assigns it to variables. var is a variable that the data is being assigned to. When Sheerpower executes an INPUT statement, it prints any prompt given and waits for the user's response. The user's response is then assigned to the variable(s) specified.
For information on INPUT from a text file, see Chapter 14, File Handling.
The user enters data in response to the INPUT statement. The input data must be the same data type as the variable, or Sheerpower generates an exception. If, in response to the INPUT statement, the user presses the [Enter] key and:
There are three types of INPUT statements:
There are four input styles:
Example 8-2 Simple Input Style |
---|
input 'Please enter your name': name$ print 'Hello '; name$ end Please enter your name? Toby Hello Toby |
Example 8-3 Formatted Data Entry Screens |
---|
input 'Please enter your name': name$ input screen 'Soc. sec.: <DIGITS: ###-##-####>': ssn print name$, 'Social security number:'; ssn end Please enter your name? Fred Soc. sec.: ___-__-____ (before input) Soc. sec.: 324-11-4533 (after input) Fred Social security number: 324114533 |
Example 8-4 Free Format Multi-Line Text Input |
---|
line input area 5, 10, 8, 60: text$ print at 10, 1: 'Rewrapped text' wt$ = wrap$(text$, 1, 30) print wt$ end This is an example of wrapped text. The text is wrapping.__________________________________________ ___________________________________________________ ___________________________________________________ Rewrapped text This is an example of wrapped text. The text is wrapping. |
Example 8-5 Pop-up Menus |
---|
sample_menu$ = '%title "Options",' & + 'Add, Change, Delete, Inquire' line input menu sample_menu$: selection$ print 'Menu option was '; selection$ end +--Options---+ | ADD | | CHANGE | | DELETE | | INQUIRE | +------------+ Menu option was CHANGE |
The INPUT statement has the following options, which are described in detail in following sections of this chapter:
PROMPT | displays the prompt text |
AT row, col | positions the cursor on the desired row and column |
LENGTH nn | limits the number of characters that a user can type |
DEFAULT | lets you provide defaults for INPUT statements |
VALID | validates user responses |
TIMEOUT | limits the time the user has to respond to the INPUT prompt |
AREA | does free format multi-line text input from an area on the screen |
SCREEN | creates formatted data entry screens |
MENU | displays and receives input from "pop-up" menus |
ELAPSED | keeps track of the time it takes the user to respond to an INPUT prompt |
ATTRIBUTES | displays in BOLD, BLINK, REVERSE |
ERASE | clears the input line prior to accepting input and after the input has been completed |
DIALOGBOX | presents the end user with simple to complex input forms. See Chapter 9, Input Dialogbox - Creating GUI Forms with Sheerpower |
Previous | Next | Contents | Index |