Use the FILLIN command to prompt the user to enter a value at the keyboard.
Options
=width
Specifies the width of the entry field. If set to zero, you do not need to press [Enter] after the response. A single key entry is accepted, although not displayed on the screen. When varname=0 is specified, you can capture these keystrokes: [Enter], [Esc], [Home], [End], [PgUp], [PgDn], [Up Arrow], [Down Arrow], [Tab], and [Shift]+[Tab]. For example, [PgDn] is recorded as [PgDn] in the variable. The [Down Arrow] key is recorded as [Down] and [Up Arrow] as [Up]. The variable used with =0 is always a TEXT data type. Alternatively, you can omit this option and use the LASTKEY function to capture the last key pressed. (This is useful with EDIT.) If a height and length are specified, the width references the width of the FILLIN box.
USING 'message'
Specifies the message text (a 1- to 80-character text string in the currently defined QUOTES character) to be displayed. You can use a dot variable in place of it. For example, if you enter FILLIN var1 USING .var2, the screen prompt is the contents of variable2.
varname
Specifies a variable name, which must be unique among the variable names within the database. The variable name is limited to 128 characters.
About the FILLIN Command
The value entered at the keyboard is stored in a global variable.
Note: It is recommended to replace code instances of the FILLIN command with the DIALOG command, which has many additional display options and is more user friendly.
Setting the Data Type
If the data type of the value that is entered is unambiguous, then the variable is set to that data type. For example, if you enter 123, the variable is given an INTEGER data type. If you wanted the data type to be TEXT, you would have to set the variable's data type. If the data type is questionable-for example, when entering a date-be sure to define the variable's data type. Also, if you use =0 to accept a single keystroke, the variable's data type must be TEXT.
Examples
The following command lines ensure that the data type is TEXT. The quotation marks around the message are not displayed on screen.
SET VARIABLE vfill TEXT
FILLIN vfill=10 USING 'Enter a number:'
The following command prompts the user for a database name and stores it in the variable v2. The database name could then be used in a CONNECT command, for example, CONNECT .v2. The dot before the variable indicates that R:BASE is to use the current value of the variable.
FILLIN v2 USING 'Enter the name of the database you want to open: '
In the following command lines, the first command line sets variable v1 to TEXT and A as its value. The =1 in the FILLIN command lets the user enter a single character or accept the letter A by pressing [Enter]. After the user responds, the program stores the response in the variable v1 and continues to the next line in the command file.
SET VARIABLE v1 TEXT = 'A'
FILLIN v1=1 USING 'Enter a letter (A-F): '
The following command lines use the =0 option to allow a single keystroke entry, then check the variable for [PgUp] and [PgDn]. If the response is [PgUp], then vend contains the value [PgUp] and GOTO transfers processing to the lines following LABEL top. If the response is [PgDn], control is passed to the lines following LABEL bottom. If neither [PgUp] or [PgDn] is entered, control passes to LABEL tryagain and the FILLIN is repeated.
LABEL top
.
.
.
LABEL tryagain
FILLIN vend=0 USING 'Press PgUp to start again, PgDn to continue.'
SWITCH (.vend)
CASE '[PgUp]'
GOTO top
CASE '[PgDn]'
GOTO bottom
DEFAULT
GOTO tryagain
ENDSW
.
.
.
LABEL bottom
The following example creates a FILLIN box 20 characters wide by three lines deep that can contain a maximum of 100 characters. If you designate a box to contain more characters than the size of the box allows, you automatically create a scrolling box.
FILLIN v1=20,3,100 USING 'Notation:'