Skip to main content

Module menu

Module menu 

Source
Expand description

Menu — a dropdown / context menu of clickable items.

Build the entries, then attach the menu to a trigger Response (for a dropdown) or show it as a context menu. show returns the index of the entry that was clicked this frame, if any.

let trigger = ui.add(sc::Button::secondary("Options ▾"));
if let Some(i) = sc::Menu::new("opts")
    .item("Rename")
    .item("Duplicate")
    .separator()
    .danger_item("Delete")
    .show(ui, &trigger)
{
    // handle click on entry `i`
}

Structs§

Menu