SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

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 

ELAPSED

The ELAPSED option keeps track of the time it takes the user to respond to an INPUT prompt. SheerPower assigns the elapsed time to the variable specified. The ELAPSED option starts marking time when SheerPower 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. SheerPower returns the elapsed time in seconds. If a real numeric variable is specified, SheerPower returns the time to a hundredth of a second (1/100).

Example 8-34 Screen format options - ELAPSED

  input 'Name', elapsed x: name$ 
  print name$; ', your elapsed time is'; x 
  end
 
        
Name? John 
John, your elapsed time is 1.39 

If an integer variable is specified, SheerPower rounds the time to the nearest second.

Example 8-35 Screen format options - ELAPSED

  input 'Name', elapsed x%: name$ 
  print name$; ', your elapsed time is'; x% 
  end
 
        
Name? Julie 
Julie, your elapsed time is 1 

BOLD, BLINK, REVERSE

The BOLD, BLINK, REVERSE options allow each input string to be displayed with its own attributes. If these format options are used together with the ATTRIBUTES option, the ATTRIBUTES option will be suppressed.

Example 8-36 Screen format options - BOLD, BLINK, REVERSE

  input screen '<at 5,10, bold,blink:@@@@@@>' + & 
               '<at 6,10, reverse:@@@@@@>': str1$, str2$ 
  end

8.17.3 The User's Response to the SCREEN Option

When a single input screen statement is used to create a fill-in screen, certain keys on the keyboard have special functions. The following keys can be used to complete the screen:

TAB

The TAB key [Tab] is used to jump to the next field in the input screen statement. Once a field is filled in, the [Tab] key must be pressed to jump to the next field.

[Esc]

The Escape key [Esc] can be used to return to a previous field. When the [Esc] key is pressed, the cursor will jump back to the beginning of the previous field and the entry can be changed.

Enter

The [Enter] key is used to complete a data entry screen. If more than one format is included in a screen option, when you have finished filling in all the fields, the [Enter] key must be pressed to complete data entry. You must be at the last field when the [Enter] key is pressed. Until the [Enter] key is pressed, you are free to change your response to any field.

Example 8-37 Enter key with INPUT SCREEN

  a$ = '<at 6, 10: Full name @@@@@@@@@@@@@@@@@@@@@@@@>' + & 
       '<at 8, 10: Address @@@@@@@@@@@@@@@@@@@@@@@@@@>' + & 
       '<at 10, 10: City @@@@@@@@@@@@>' + & 
       '<at 10, 38, aj, req, letters: State ^^>' + & 
       '<at 10, 50, req, digits: Zip #####>' 
  clear
  input screen a$: name$, addr1$, city$, state$, zip$ 
  delay
  clear
  print at 6, 10: name$ 
  print at 8, 10: addr1$ 
  print at 10, 10: city$; ', '; state$; '   '; zip$ 
  end
 
        
 
Full name Sunny Day_______________ 
 
Address 2356 Main St._____________ 
 
City San Diego___           State CA    Zip 92131 
 
 
               Press the Enter key to continue 
 
Sunny Day 
 
2356 Main St. 
 
San Diego, CA   92131 

8.18 MENU Option

The MENU option is used to create pop-up menus.

FORMAT:


        [LINE] INPUT MENU str_expr: str_var 

str_expr is a string expression that describes the menu. It consists of multiple, comma-separated elements. The elements can be either items or directives.

EXAMPLE:

Example 8-38 MENU option in INPUT

  title$ = '%title "structure",%multi,' 
  box_loc$ = '%at 10,15,' 
  client$ = '"TTI_Client"={id,name={Cass,Brock,Errant},phone},' 
  address$ = 'address={%bar,street,city,state,country},' 
  misc$ = 'misc={%replace,mail,record}'   
  menu$ = title$ & box_loc$ & client$ & address$ & misc$ 
  line input menu menu$: ans$ 
  end
 
        
               +---STRUCTURE---+ 
               |  TTI_CLIENT  +---ADDRESS--+ 
               |  ADDRESS     |------------| 
               |  MISC...     |  STREET    | 
               +--------------|  CITY      | 
                              |  STATE     | 
                              |  COUNTRY   | 
                              +------------+ 


Previous Next Contents Index