ID: Q119886
2.5x 2.60 2.60a | 2.00 2.5x 2.60 2.60a | 2.5x
WINDOWS | MS-DOS | MACINTOSH
kbprg
The information in this article applies to:
In FoxPro, the WHEN clause of an object is triggered any time an item in a list box is selected. In the following example, a user can select an item from a list box using a single mouse click instead of double-clicking the item as would be required if only the VALID clause were used.
1. USE the CUSTOMER table found in the <FoxPro_directory>\TUTORIAL
subdirectory.
2. Create a new screen.
3. In the Setup code for the screen, add the following command:
SELECT COMPANY FROM CUSTOMER INTO ARRAY TEST
4. Create a GET field. In the Input box, type "X" (without the quotation
marks).
5. Place a list box on the screen. In the List Items box, select the From
Array option and type "TEST" (without the quotation marks) for the array
name. In the box for the list box variable, type "LISTVAL" (without the
quotation marks) for the variable name.
6. In the WHEN clause of the list box, enter the following code:
X=TEST(LISTVAL) && Assign the GET field variable a value.
SHOW GET X && Update screen.
7. Generate the screen and run it.
The GET field will be automatically filled with the first value in the list box. If the user clicks (or double-clicks) any item in the list box, the GET field will be updated. Additionally, if the user presses TAB to move to the list box, the currently selected value in the list box will update the contents of the GET field.
Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.50c 2.60 2.60a listbox KBCategory: kbprg KBSubcategory: FxprgGeneral
Keywords : FxprgGeneral
Version : 2.5x 2.60 2.60a | 2.00 2.5x 2.60
Platform : MACINTOSH MS-DOS WINDOWS
Last Reviewed: May 1, 1996