A selection box shows an immediately visible list allowing you to choose one (by default) or more options.
A WSelectionBox corresponds to an HTML <select> element.
WSelectionBox is a View widget (see also Model-View-Controller). By default a WStringListModel is used. With this model you can associate a single column of data to the displayed items. The member methods addItem(), insertItem() and removeItem() manipulate the model. You can set the model with setModel(). See the Combo box section for an example.
A model supports different roles like Wt::ItemDataRole::DisplayRole and Wt::ItemDataRole::UserRole. The suggestion text for an item in the drop-down box is associated with a Wt::ItemDataRole::DisplayRole. The value, which will be inserted in the line-edit, corresponding with a suggestion, is stored as Wt::ItemDataRole::UserRole) data. If no UserRole data is available, the behaviour defaults to inserting the suggestion text iteself.
Note that there are still other models like WFormModel which and can be used to represent fields in a form.
Use shift and/or ctrl-click to select your pizza toppings...