Chapter 16. ComboBox Class

Table of Contents
Add
Insert
Delete
DeleteAll
Find
SelectedIndex
Selected
SelectIndex
Select
Items
GetText
Modify
AddDirectory
OpenDropDown
CloseDropDown
IsDropDownOpen
EditSelection

There are 3 types of combo 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.

Requires:

The ComboBox class requires the class definition file oodwin32.cls:

::requires "oodwin32.cls"

Methods:

Instances of the ComboBox class implement the methods listed in the ComboBox Instance Methods table.

Table 16-1. ComboBox Instance Methods

Method......on page
AddAdd
AddDirectoryAddDirectory
CloseDropDownCloseDropDown
DeleteDelete
DeleteAllDeleteAll
EditSelectionEditSelection
FindFind
GetTextGetText
InsertInsert
IsDropDownOpenIsDropDownOpen
ItemsItems
ModifyModify
OpenDropDownOpenDropDown
SelectSelect
SelectIndexSelectIndex
SelectedSelected
SelectedIndexSelectedIndex

Add

>>-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.

Arguments:

The only argument is:

listEntry

A text string added to the list.

Return value:

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.