There are 3 types of combo boxes.
Simple combo boxes
Drop-down combo boxes
Drop-down list boxes
A combo box consists of a list and a selection field. The list presents options that can be selected and the selection field displays the current selection.
In simple and drop-down combo boxes the selection field is an edit control and can be used to enter text not available in the list, or to edit existing text. In drop-down list combo boxes, the list is a list box control and the use can only select the items. In a drop-down combo-box the list only appears when the user opens it. In a simple combo box the list is always visible.
The ComboBox class provides methods to query and modify combo box controls. It inherits all methods of the DialogControl class (see DialogControl Class)
Use the GetComboBox method (see GetComboBox) to retrieve an object of the ComboBox class.
The ComboBox class requires the class definition file oodwin32.cls:
::requires "oodwin32.cls"
Instances of the ComboBox class implement the methods listed in the ComboBox Instance Methods table.
Table 16-1. ComboBox Instance Methods
| Method... | ...on page |
|---|---|
| Add | Add |
| AddDirectory | AddDirectory |
| CloseDropDown | CloseDropDown |
| Delete | Delete |
| DeleteAll | DeleteAll |
| EditSelection | EditSelection |
| Find | Find |
| GetText | GetText |
| Insert | Insert |
| IsDropDownOpen | IsDropDownOpen |
| Items | Items |
| Modify | Modify |
| OpenDropDown | OpenDropDown |
| Select | Select |
| SelectIndex | SelectIndex |
| Selected | Selected |
| SelectedIndex | SelectedIndex |
>>-aComboBox~Add(--listEntry--)--------------------------------><
The Add method adds a new item to the list of the combo box. If the list is not sorted, the new item is added to the end of the list.
The only argument is:
A text string added to the list.
A one-based index that specifies the position at which the entry has been added, or 0 or a value less than 0 to indicate an error.