Modifying the contents of a list

The x::w::listlayoutmanager: does not manage discrete widgets, but a vertical list of text labels in selection lists, combo-boxes, and menus. The append_items(), insert_items(), replace_items(), and replace_all_items() items add new items to the list, combo-box, or a menu, whatever the case may be. These methods receive a std::vector containing the new list items.

This vector contains x::w::list_item_params. x::w::list_item_param is a (subclass-of a) std::variant.

        "Dolor sit amet"

This is an example of passing a std::vector<x::w::list_item_param> to append_items(), adding new items to the list. The basic values of x::w::list_item_param are:

All items in a selection list get automatically numbered starting with 0, and get automatically renumbered whenever list items get added or removed from the list. size() returns the number of items in the list. Each list item is specified by its item number, when using selected(), enabled(), and other list methods. A x::w::separator is a discrete list item, and merits an item number of its own, in that regard. The above example creates items #0 through #3, if the selection list was empty.


size() will not immediately reflect the new size of the list after calling append_items(), insert_items(), replace_items(), replace_all_items() and remove_item(). The contents of the widget get updated by the connection thread. These methods send a message to the connection thread, which then makes the corresponding update.

A callback from the connection thread has access to the overloaded IN_THREAD methods, which immediately update the list items.


The height of the selection list gets specified as the number of list rows. The actual height gets computed based on the height of the list's items. Using custom fonts and separators results in a selection list with rows of varying height.