ComboBox Control
Description
The ComboBox control is used to display data in a dropdown combo box.
By default, the ComboBox control appears in two parts: the top part is a text box that allows the user to type a list item. The second part is a list box that displays a list of items from which the user can select one.
Usage
The ComboBox control can behave in three different ways, depending on the value of the DropDownStyle property.
DropDownStyle = Simple
In simple mode, there is a textbox above a list box. The operator can edit or add selections by typing in the textbox area.
DropDownStyle = DropDown
In this mode, the listbox portion is not displayed until the operator clicks the down arrow button located on the right side of the text area. The operator can edit the selected text in the textbox area.
DropDownStyle = DropDownList
When DropDownList is specified, the operator cannot type text in the textbox area. Only items in the list can be selected.
For information on how to add items to the listbox portion of the ComboBox control, see the Usage information for the ListBox control for information on AddItem, List, ListCount, and SelectedIndex.
Setting ComboBox Appearance
Use the ForeColor, BackColor, and Font properties to change the appearance of the combobox.
ComboBox Control Properties
Property | Description |
---|---|
AddItem | Adds an item to the list at runtime. (Only available from SPEL+ programs) |
BackColor | The background color for the control. Default: Window |
DropDownStyle | Specifies the style of the combo box. Default: DropDown |
Enabled | Sets whether the control is enabled at runtime. Default: True |
EventTaskType | The type of task used for events. Default: Normal |
Font | The font for the control text. Default: Microsoft Sans Serif 8.25 pt |
FontBold | The bold attribute for the current font Default: False |
FontItalic | The italic attribute for the current font Default: False |
FontName | The name for the current font Default: Microsoft Sans Serif |
FontSize | The size for the current font in points Default: 8.25 |
ForeColor | The foreground color for the control text. Default: WindowText |
Height | The height of the control in pixels. |
Left | The left coordinate of the control in pixels. |
List | Use to access the items in the list at runtime. (Only available from SPEL+ programs) |
ListCount | Use to get the number of items in the list at runtime. (Only available from SPEL+ programs) |
Name | The name of the control. Default: ComboBoxXX |
SelectedIndex | Use to determine which item has been selected by the operator at runtime. (Only available from SPEL+ programs) |
Sorted | Sets whether to sort the items in the list or not. Default: False |
TabIndex | The tab index of the control. |
Text | The text of the control. Default: Empty |
ToolTipText | The text used in the control’s tooltip. Default: Empty |
Top | The top coordinate of the control in pixels. |
Visible | Whether the control is visible or not at runtime. Default: True |
Width | The width of the control in pixels. |
ComboBox Control Events
Event | Description |
---|---|
Click | Occurs when a control is clicked. |