Esc

Menu_Item

structextensionexperimentalsince 0.36.1Source
  • macOS: Menu_Item works on macOS
  • Linux: Menu_Item works on Linux
  • Windows: Menu_Item works on Windows
  • Wasm: Menu_Item is not available on Wasm

Declaration

Menu_Item :: struct {
    menu: string;    title: string;// nonzero; unique in the menu    action: u16;// uppercase ASCII letter; 0 means no shortcut    key: u8;    shift: bool;}

A flat native menu entry. menu groups entries into top-level menus; action must be unique and nonzero. key is an uppercase ASCII letter (0: none), with Cmd on macOS or Ctrl on Windows. shift adds Shift. Strings are borrowed only during creation.

Example
item := Menu_Item.{ menu = "File", title = "Open…", action = 1, key = #char "O" };
assert(item.action == 1);

See also