Guide API
Skip to main content

hot_key

Function hot_key 

Source
pub fn hot_key(menu: &Menu, key: KeyEvent) -> Option<Command>
Expand description

Find the menu item whose accelerator matches key and return its Command.

Walks the items in declaration order, skips separators, and recurses into submenus regardless of the submenu’s own disabled flag (a submenu has no command of its own to match, so only its contents are searched). A command item matches only when it is not disabled and its accelerator equals Some(key) — an item with no accelerator (None) never matches. The first match wins (depth-first, in declaration order).

§Turbo Vision heritage

Ports TMenuView::findHotKey (via hotKey, tmnuview.cpp).