How to Create Validation and Selection Popups for FieldsLast reviewed: April 30, 1996Article ID: Q119230 |
The information in this article applies to:
SUMMARYWhile the list popup available in the Screen Builder is adequate for many purposes, it lacks a number of features that are available only through programming. The following examples demonstrate two forms of popups; the first is activated when the field is entered to allow selection of available values in a database, whereas the second is activated only after an invalid entry is made. Both popups allow the user to type in the first few letters to rapidly select a close match and then scroll up and down to select the exact item. After a selection is made, the remaining fields are filled in with the data from the selected record.
MORE INFORMATION
Functionality of the PopupsA key value created to uniquely identify a record (such as a customer number) is usually short and cryptic, which is ideal for use with an index and storage within a database. However, the cryptic nature of the key value poses a problem when the value must be entered in a screen input field in order to retrieve the matching record, as it becomes increasingly difficult for the user to remember what the codes represent when the number of different codes increases. The two types of popups discussed below address this problem by presenting a list of valid choices that correspond to the codes (such as company names), rather than a list of valid codes. The common code in both snippets performs the following actions:
The following steps use the TUTORIAL\CUSTOMER.DBF file to create a screen named POPLIST.SPR for editing existing records:
Field Validation PopupTo demonstrate this type of popup, run POPLIST.SPR, and while in the CUSTNO field, press ENTER (or type a customer number that does not exist in the CUSTOMER database). The VALID clause attempts to locate a record whose customer number matches the CUSTNO value you typed. If a match is found, the record pointer is positioned on the matching record, and the SHOW GETS command updates the screen with the new values. If no match is found, the list of company names is presented. Type in the first few letters of a company name, then scroll down or up to select the desired record. Press ENTER, and then observe the new field values. The cursor should now be in the CONTACT field.
Auto-Activate PopupTo demonstrate this type of popup, run POPLIST.SPR, and press the TAB key to move from the CONTACT field to the COMPANY field. As soon as the cursor leaves the CONTACT field, the company name popup list is activated. Once the popup is open, its functionality is identical to that of the validation popup.
|
Additional reference words: FoxDos FoxWin 2.00 2.50a 2.50b 2.60 picklist
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |