How to Display Disabled Items in a Combo or List Box
ID: Q133743
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, versions 3.0, 6.0
SUMMARY
This article shows by example how to disable items in a combo box or list
box.
MORE INFORMATIONCombo Box Example
- Create a Form with a combo box (either with a style of DropDown Combo or
DropDown List).
- In the DblClick method of the DropDown Combo or the RightClick method of
the DropDown List, place this code:
This.List(This.ListItemId)='\'
NOTE: The DblClick method in the DropDown List does not disable the
item. That is why a RightClick method is recommended.
- In the RowSource for the combo box, place this code:
SELECT DISTINCT city from customer into cursor MyCity
NOTE: In general, it doesn't matter what the RowSource or Type are.
- In the RowSourceType for the combo box, select 3 - SQL Statement.
- Run the Form, and select an item on the list. When the item appears in
the combo box, you can disable the item by double-clicking it or by
clicking it using the right mouse button.
Possible Enhancements
- If you want to disable a specific item on the list, you can replace the
ListItemId with a specified Item Number.
- You can use the ComboBox Layout DisabledItemForeColor property to change
the color of the disabled item text.
Additional query words:
VFoxWin OOP combobox listbox
Keywords : kbcode kbVFp300 kbVFp600 FxprgGeneral
Version : 3.00
Platform : WINDOWS
Issue type :
|