The information in this article applies to:
- Microsoft FoxPro for Windows versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
SUMMARY
This article shows by example how to erase incorrect data entered in an
@...GET field quickly by pressing a single predefined key.
MORE INFORMATION
A screen that has one or more @...GET fields can serve the purpose of a
data entry screen. Such screens may need a quick method for erasing
erroneous data entered into any one of the input fields. In addition, users
often want a quick way to delete information from an input field without
having to use the Backspace key or drag a mouse pointer across the field.
The following procedure gives a method you can use to clear input field
information quickly.
Step-by-Step Example
- Create a screen containing two @...GET fields and an Exit button that
terminates the .SPR program. The Exit button is necessary because the
ESC key will be used to execute an external program. However, you can
use a key other than ESC.
- Assign the variable name "m.getone" (without the quotation marks) to the
first @...GET field, and assign the the variable name "m.gettwo"
(without the quotation marks) to the second @...GET field.
- Within the Setup Code of this screen, add the following command line:
ON KEY LABEL esc DO WIPEOUT.PRG
- Save the file as WIPEOUT.SCX. Then from the Command window, type:
MODIFY COMMAND wipeout.prg
- Enter the following code in WIPEOUT.PRG:
fldname = VARREAD()
STORE " " TO (fldname)
SHOW GET (fldname)
RETURN
- Save WIPEOUT.PRG. Then generate WIPEOUT.SPR from the WIPEOUT.SCX file.
- From the Command window, type:
DO WIPEOUT.SPR
When the generated screen appears, enter random data into the first
@...GET field. Then press the ESC key to generate the following events:
- Call WIPEOUT.PRG.
- Use VARREAD() to assign to the 'fldname' variable the name of the
@...GET field in which the cursor currently resides.
- Store a blank at the address where the 'fldname' variable resides.
- Show the new value that has been assigned to this address.
- Return, allowing the user to re-enter new data.
- Press the TAB key to move to the second @...GET field. Notice that the
same process can be executed within this input field as well.
|