Picker
Choose a single item from a list of items.
| Header | #include "nativeui/picker.h" | 
| Namespace | namespace nu | 
| Type | class (RefCounted) | 
| Inherits | View | 
By default, the first item is automatically selected, and duplicate items are merged into one.
Constructors
Picker()
Create a new Picker view.
Class properties
const char* kClassName
The class name of this view.
Methods
void AddItem(const std::string& title)
Add an item with title to the end.
Parameters
- const std::string&title
void RemoveItemAt(int index)
Remove the item at index.
Parameters
- intindex
std::vector<std::string> GetItems() const
Return all items.
Return
std::vector<std::string>void SelectItemAt(int index)
Select the item at index.
Parameters
- intindex
std::string GetSelectedItem() const
Return the title of selected item.
Empty string is returned if there is no selected item.
Return
std::stringint GetSelectedItemIndex() const
Return the index of selected item.
-1 is returned if there is no selected item.
Return
intEvents
void on_selection_change(Picker* self)
Emitted when user has changed the selected item.
Parameters
- Picker*self