How to Simulate a Combo Box in FoxPro for WindowsID: Q124779 2.60a WINDOWS The information in this article applies to:
SUMMARYA combo box is a object into which you can enter data directly or select an item from a predefined drop-down list. FoxPro does not have a combo box option to choose when making a screen, but you can use the technique presented in this article to simulate a combo box in FoxPro.
MORE INFORMATIONThe code in the VALID clause of the GET object will vary depending on where the information for the drop-down list comes from: arrays, a field from a table, or defining bars for the popup box. Use the following steps to make a combo box by using a popup with a predefined list: 1. Create a screen in FoxPro, and add a GET object to the screen, giving it 2. In the VALID clause of the object COMBO, add the following code:
3. In the cleanup code of the screen, add the following code:
4. Add a push button to the screen; call it EXIT. In the VALID clause,
After generating and running the screen, you will see that the object that
represents the combo box is blank. If information is not typed into the
object before the ENTER key is pressed, the code in the VALID clause of the
field is executed and the popup appears.
Adjust the coordinates in the DEFINE POPUP statement if you want the popup to overlay the get field exactly. The example code shows how to define bars for the popup. If you want information from a field to be listed in the popup, change the code as indicated below. NOTE: This code uses the CUSTOMER.DBF file located in the TUTORIAL subdirectory of FoxPro. In the VALID clause of the COMBO GET object, change the code to match this:
In the cleanup code, change the code to match this:
This revised code fills the popup with the information from all the records
in that table of that field. Again, to position the popup on the screen
where you want it, experiment with the numbers of the DEFINE POPUP
statement.
Additional reference words: FoxWin SBuilder 2.60a KBCategory: kbprb KBSubcategory: FxtoolSbuilder
|
|
Last Reviewed: May 22, 1998 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |