Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

8.16 INPUT DIALOGBOX Option

INPUT DIALOGBOX provides the user with all the power of HTML forms without using a web browser. For a complete discussion of INPUT DIALOGBOX please see Chapter 9.

FORMAT:


        INPUT DIALOGBOX str_exp: str_var 

str_expr specifies the dialogbox format.

8.17 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.

FORMAT:


        SCREEN str_expr 

str_expr specifies the screen format.

EXAMPLE:

Example 8-21 SCREEN Option

  input 'Your name, please': name$ 
  input screen 'Soc. sec.: <DIGITS:###-##-####>': SSN 
  print name$, 'Social security number:'; SSN 
  end
 
        
Your name, please? John 
Soc. sec.: ___-__-____ 

When the program executes, Sheerpower 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 [Enter] key is pressed, the number is assigned to the variable SSN.


Your name, please? John 
Soc. sec.: 555-48-6662 
John                Social security number: 555486662  

The SCREEN option can be used 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.

8.17.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:

Example 8-22 Screen Format Characters -#

  input screen '<:(###) ###-####>': phone 
  print phone 
  end

When Sheerpower executes this program, it displays the following fill-in area:


 
(___) ___-____ 
 
        
(555) 554-7879 
5555547879 

@

The @ is used to specify any printable character, including letters and numbers.

Example 8-23 Screen Format Characters -@

  input screen 'License #: <@@@ @@@@>': license$ 
  print 'License: '; license$ 
  end
 
        
License #: INF 5783          <-------- type in a license number 
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.

Example 8-24 Screen Format Characters - .

  print 'Input .59, please' 
  input screen 'Amount: <###.####>': amt$ 
  print 'Amount = '; amt$ 
  end
 
        
Amount:    .         <------ type in .59 here 
Amount = .5900 

^

The ^ is used to specify an UPPERCASE letter. If the next character inputted is a lowercase letter, Sheerpower will change it to uppercase.

Example 8-25 Screen Format Characters -^

  input screen 'First name: <^@@@@@@@@@@@@@>': first$ 
  input screen 'Middle initial: <^>.': middle$ 
  input screen 'Last name: <^@@@@@@@@@@@@@@@>': last$ 
  print first$; ' '; middle$; '. '; last$ 
  end
 
 
First name: John___________          <-------- type in john 
Middle initial: B.                   <-------- type in b. 
Last name: Smithy___________         <-------- type in smithy 
John B. Smithy 

Example 8-26 Screen Format Characters - ~

  input screen 'Comparison: <### ~> ###>': a$ 
  print a$ 
  end 
 
 
 

8.17.2 Screen Format Options

If format options are used, they must be placed before the format characters and followed by a colon. The following format options are available:

UCASE

UCASE uppercases all letters that are typed. If a letter is typed in lowercase, it is changed to uppercase.

Example 8-27 Screen Format Options - UCASE

  print 'Type in some text!' 
  input screen '<ucase:@@@@@@@@@@@@@@@@@@@@>': text$ 
  print 'Here is your text: '; text$ 
  end
 
        
Type in some text! 
JOHN B. SMITHY______                <-------- type in 'john b. smithy 
Here is your text: JOHN B. SMITHY 

LCASE

LCASE lowercases all letters that are typed. If a letter is typed in uppercase, it is changed to lowercase.

Example 8-28 Screen Format Options - LCASE

  print 'Type in some text!' 
  input screen '<lcase: @@@@@@@@@@@@@@@@@@@@>': text$ 
  print 'Here is your text: '; text$ 
  end
 
        
Type in some text! 
john b. smithy                   <-------- type in JOHN B. SMITHY 
Here is your text: john b. smithy 

NOECHO

With the NOECHO/bold screen format option, typed characters are not echoed (printed) on the screen.

Example 8-29 Screen Format Options - NOECHO

  input screen '<noecho:Password? @@@@@>' : pw$ 
  print pw$ 
  end
 
        
Password? _____ 
Elene               

DIGITS

The DIGITS screen format option allows only digits to be entered in the field. The format character # also allows the minus sign and the decimal point.

Example 8-30 Screen Format Options - DIGITS

  input screen 'Phone: <digits:###-####>': phone 
  print phone 
  end
 
        
Phone: 555-6798 
 5556798 

AJ

AJ causes Sheerpower to jump automatically to the next field when the current field has been filled in. The field must be completely filled in before Sheerpower will jump to the next field.

Example 8-31 Screen Format Options - AJ

  input screen 'Phone: <AJ, digits:###-####>': phone 
  input screen 'Soc. sec.: <digits:###-##-####>': ssn 
  print phone, ssn 
  end
 
        
Phone: 555-3839 
Soc. sec.: 899-75-3432 
 5553839            899753432 

REQ

REQ specifies that input is required and something must be entered. The computer will beep and prompt until valid input is entered.

AT row, column

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.

Defaults can be supplied 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.

Example 8-32 Screen Format Options - AT row, column

  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$ 
  end
 
        
City     St. Paul 
State    MI 

VALID

The VALID option allows full validation of each field on the screen. (See the VALID function in Chapter 6 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 semicolons.

Example 8-33 Screen Format Options - VALID

  input screen 'code = <valid "integer":###-##-##>': ans$ 
  print ans$ 
  end
 
        
code = 121-23-47 
1212347 


Previous Next Contents Index