Skip to main content

select

Function select 

Source
pub fn select(
    ui: &mut Ui<'_>,
    label: &str,
    options: &[&str],
    current: Option<usize>,
) -> Key
Expand description

A choice among a few named options: a field that shows the one in force and, clicked, drops a menu of them all with the current one checked. options are the labels, current the index in force (or none). Keyed by label, which is the accessible name too.

The menu is the core’s own — the same one a right-click opens (Core::open_menu): drawn in the frame, or the platform’s where the host shows menus itself, dismissed by Escape or a press outside, its rows walked by the arrows. So the app holds no open state; what it hears is the choice, as the menu event a menu row posts, on this key: {kind: "menu", role: "custom", item: <the option>}. A view that then draws the select with the new current is the whole loop.

select_items is the same field over MenuItems, for an option that posts an id of its own rather than its label.