Retrieving the standard combo-box's current selection

x::w::new_standard_comboboxlayoutmanager inherits selected() and size() from the list layout manager:

size_t s=cbmanager->size();

std::optional<size_t> current_value=cbmanager->selected();

selected() indicates the currently selected standard combo-box item, if there is one. combobox.C shows how to use the alternative option of installing a callback that gets invoked to report each combo-box selection change.

The combo-box's label shows the most recently selected combo-box item. It gets sized automatically to be just big enough for the longest item in the combo-box. x::w::new_standard_comboboxlayoutmanager's constructor takes an optional callback parameter. This callback gets invoked whenever a combo-box item gets selected or deselected, in addition to updating the combo-box's label. The callback receives a x::w::standard_combobox_selection_changed_info_t parameter.

combobox.C installs a callback that logs Selected item # whenever it changes. x::w::new_standard_comboboxlayoutmanager's selected() method returns the currently selected combo-box item (if there is one). x::w::new_standard_comboboxlayoutmanager calls it before closing its window, to show the final combo-box selection.