Skip to main content

attach_context_menu

Function attach_context_menu 

Source
pub fn attach_context_menu(
    response: &Response,
    commands: &[Command],
    on_pick: impl FnMut(&'static str),
)
Expand description

Attach a theme-aware right-click context_menu to any Response, threading the picked command id out through on_pick. The closure fires at most once, on the frame an item is clicked.

let cmds = [Command::new("copy", "Copy", "Edit")];
let resp = ui.label("right-click me");
attach_context_menu(&resp, &cmds, |id| { /* dispatch id */ let _ = id; });