Previous | Contents | Index |
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 |
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 |
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:
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.
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.
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 |
The MENU option is used to create pop-up menus.
[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 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 | +------------+ |
Menu items consist of either a description or a description and = sign followed by either a data value or a submenu indicator. If no = sign is given, the data value is the same as the description. If the description contains spaces or special characters, it must be enclosed within quotes. 5.
The default for INPUT MENU is to return all unquoted parameters as uppercase. For example, to return the word "ctrl" in lowercase when "Control Panel" is selected:
line input menu '"calculator" = calc,"DOS prompt" = dos, "IE" = IE, "Notepad" = notepad, "Control Panel" = "ctrl", "exit"': ans$ |
Up to 5000 menu items can be handled.
Menu descriptions are displayed on the menu for the user to choose.
The data value is the value returned to the application when the menu item is chosen.
A submenu indicator consists of a "{" followed by menu elements followed by "}".
The following directives can be used with the [LINE] INPUT MENU statement:
The menu or submenu box can be placed at a given row and column. CENTER can be used in place of row and/or column to center a menu or submenu.
%at row, center %at center, column %at center, center |
The %ATTACHED menu directive causes the resulting menu window to be "attached" to the SP4GL Console Window (when there is some console output). If the console window is minimized or restored, the attached menu window will minimize or be restored with it.
%attached |
Example 8-39 %ATTACHED Menu Directive |
---|
print 'Illustrating %attached menu directive...' print print 'Minimize the Sheerpower Console Window...' print 'and the "attached" menu will minimize along with it!' menu$ ='%attached, OPEN, SHOW, PRINT, %heading "GUIDE_OPTIONS", NOSYSTEM, "MENU ON|OFF"' line input menu menu$ : ans$ end |
Separates DESCRIPTIVE items with "----". The separated line consists of the characters specified in a "text_str". If no text is given, the separated line defaults to a dashed line.
%BAR ['text_str'] |
Example 8-40 %BAR Menu Directive |
---|
menu$ = '"DATA ENTRY", "REPORTS", %bar"*", MAIL, EXIT' line input menu menu$ : ans$ end +---------------+ | DATA ENTRY | | REPORTS | | ********** | | MAIL | | EXIT | +---------------+ |
The %COLUMNS directive sets the number of columns for the menu.
%COLUMNS number |
Example 8-41 %COLUMNS Menu Directive |
---|
menu$ = '%columns 3,"DATA ENTRY","REPORTS",MAIL,HELP,EXIT' line input menu menu$ : ans$ end +-------------------------------------+ | DATA ENTRY | HELP | EXIT | | REPORTS | MAIL | | +-------------------------------------+ |
The %HEADING directive displays a blank line and a "text_str" between menu items. If no "text_str" is given, the line defaults to a dashed line.
Previous | Next | Contents | Index |