Class WSelectionBox

public class WSelectionBox
extends WComboBox
A selection box allows selection from a list of options.

By default, a selection box may be used to let the user select one item from a list. This may be changed to multiple selection mode using setSelectionMode().

The current selection may be set and read using WComboBox#setCurrentIndex() and WComboBox.getCurrentIndex(), for SelectionMode.SingleSelection mode, or setSelectedIndexes() and getSelectedIndexes() for SelectionMode.ExtendedSelection mode. The WComboBox.activated() and WComboBox.sactivated() signals are not emited in the SelectionMode.ExtendedSelection mode, use the WFormWidget.changed() signal.

WSelectionBox is an MVC view class, using a simple string list model by default. The model may be populated using WComboBox#addItem() or WComboBox#insertItem() and the contents can be cleared through WComboBox.clear(). These methods manipulate the underlying WComboBox.getModel().

To use the selectionbox with a custom model instead of the default WStringListModel, use WComboBox#setModel().

WSelectionBox is an inline widget.


The widget corresponds to the HTML <select> tag and does not provide styling. It can be styled using inline or external CSS as appropriate.