Guide API
Skip to main content

activate

Function activate 

Source
pub fn activate(
    bar_id: ViewId,
    bar_menu: Menu,
    bar_bounds: Rect,
    owner_size: Point,
    open_index: Option<usize>,
    ctx: &mut Context<'_>,
)
Expand description

Open a menu session from the bar.

Two activation kinds, distinguished by open_index:

  • Menu key (F10) (open_index == None): the bar is highlighted on its default title with auto_select off, and no box opens — the key only highlights the default title and waits for the next key.
  • Hotkey (open_index == Some(idx)): the bar is highlighted on the matched title with auto_select on, and the matched title’s box is opened in the SAME deferred batch (no dead first event); auto_select persists so a later Left/Right re-opens neighbouring titles.

A hotkey that names a top-level command (not a submenu) posts that command and opens no session at all.

bar_menu is a clone of the bar’s menu; bar_bounds its bounds in the root frame; owner_size the root group size.