The information in this article applies to:
- Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
- Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a
- Microsoft FoxPro for Macintosh, versions 2.5x
SUMMARY
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.
MORE INFORMATION
- USE the CUSTOMER table found in the <FoxPro_directory>\TUTORIAL
subdirectory.
- Create a new screen.
- In the Setup code for the screen, add the following command:
SELECT COMPANY FROM CUSTOMER INTO ARRAY TEST
- Create a GET field. In the Input box, type "X" (without the quotation
marks).
- 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.
- 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.
- 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.
|