pub fn popup_menu(
where_: Point,
menu: Menu,
owner_size: Point,
ctx: &mut Context<'_>,
)Expand description
Open a standalone context popup MenuBox near where_, run as a single-box
MenuSession on the capture stack.
This is a single box level (no bar above it) consuming events on the capture stack — the same handler as a bar dropdown, minus the bar. Two popup-specific behaviours:
- No default highlight on open: the level starts with nothing highlighted
AND its cloned
Menu::defaultis cleared, so a mouse release on a margin highlights the first item. - No exit-click re-post: a click outside the popup closes it without
re-posting the click, so the session’s
put_click_event_on_exitis setfalse.
where_ is in root-group coords (the root group is at (0,0)). owner_size is
the root group size.
This function returns immediately; the chosen command arrives later via
Context::post (in end_session_with) when
the user selects an item, reaching the active routing. A popup needs no separate
accelerator handling: it is run modally and the session owns the event loop, so
the flat loop’s hotkey handling already covers it.
§Turbo Vision heritage
Ports popupMenu/TMenuPopup (popupmnu.cpp/tmenupop.cpp/menus.h). The
blocking modal call becomes an async capture-stack session that posts the
chosen command (deviation D9); the receiver group argument is dropped because
there is no per-receiver routing seam.