ComboBox

Version: 9.0

The ComboBox control shows a drop-down list of items. When a user selects an item from the list, the ComboBox control returns the value of the selected item (as selectedValue).

You bind the ComboBox control to a data source in the Items property, and it shows all the items that the data source retrieves.

The ComboBox control shows the display names of the items by default, but you can use the DisplayFieldName property of the ComboBox control to select another item field to show.

SPEAK selects the first (top) item in the ComboBox control by default. This means that the selectedItem member never returns null if the ComboBox control has any items at all.

You can set properties of a ComboBox control programmatically in different ways, however, you should use the rebind function to do this using this syntax:

rebind (items, selectedItem, selectedValue, displayFieldName, valueFieldName)

If you provide both selectedValue and selectedItem, the ComboBox control uses selectedItem.

Properties

Name

Description

Default

Appearance

WidthPolicy

Specify how SPEAK interprets the width of the control. You can specify:

  • Default: the default width of the control is used.

  • BlockLevel: the width is set relative to the width of the container.

Default.

Data

DisplayFieldName

Specify the name of the item field that the ComboBox control shows.

$displayName

Items

You can bind the the ComboBox control to a data source and it shows the items retrieved by this data source.

itemId

SelectedItem

Specify the selected item by name.

The first (top) item

SelectedValue

Specify the selected item by value (ID).

ValueFieldName

Specify the data field that the ComboBox control uses as the option value (and returns as selectedValue).

ID of the item.

Configuration

You can create a configuration item for a ComboBox control by creating an item based on the ComboBox Parameters template.

The configuration item has these specific fields:

  • DisplayFieldName

It inherits these fields:

  • IsEnabled

  • IsVisible

  • AccessKey

  • Tooltip

  • Behaviors

  • Id

Do you have some feedback for us?

If you have suggestions for improving this article,