On this page:
Menu  Bar
Menu
Popup  Menu
Popup  Menu.popup
Menu  Item
Checkable  Menu  Item
Menu  Item  Separator
Menu  Item.Shortcut
Menu  Item.default_  shortcut_  prefix
0.45+9.1.0.3

8 Menus🔗ℹ

class

class gui.MenuBar():

  implements View

  constructor (

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    item :: ObsOrValue.of(Menu),

    ...

  )

Creates a menu bar for association with a Window through its ~menu_bar constructor argument.

class

class gui.Menu():

  implements MenuChildView

  constructor (

    label :: ObsOrValue.of(View.LabelString),

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~help: help_text :: ObsOrValue.of(maybe(View.LabelString)) = #false,

    item :: ObsOrValue.of(MenuChildView),

    ...

  )

Creates a menu containing menu items and submenus for inclusion in a MenuBar, Menu, or PopupMenu.

class

class gui.PopupMenu():

  constructor (

    item :: ObsOrValue.of(MenuChildView),

    ...

  )

 

method

method (menu :: gui.PopupMenu).popup(

  view :: WindowChildView,

  x :: View.PositionInt,

  y :: View.PositionInt

) :: Void

Creates a popup menu containing menu items and submenus. Render a popup menu using PopupMenu.popup or WindowChildView.popup.

A method call menu.popup(view, x, y) is equivalent to view.popup(menu, x, y).

class

class gui.MenuItem():

  implements MenuChildView

  constructor (

   label :: ObsOrValue.of(View.LabelString),

   ~action: action :: Boolean -> ~any = values,

   ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

   ~help: help_text :: ObsOrValue.of(maybe(View.LabelString)) = #false,

   ~shortcut: shortcut :: ObsOrValue.of(maybe(MenuItem.Shortcut))

                = #false

  )

Creates a menu item for including in a menu.

class

class gui.CheckableMenuItem():

  implements MenuChildView

  constructor (

   label :: ObsOrValue.of(View.LabelString),

   ~is_checked: is_checked :: ObsOrValue.of(Boolean) = #false,

   ~action: action :: () -> ~any = values,

   ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

   ~help: help_text :: ObsOrValue.of(maybe(View.LabelString)) = #false,

   ~shortcut: shortcut :: ObsOrValue.of(maybe(MenuItem.Shortcut))

                = #false

  )

Like MenuItem, but for a menu item that can have a checkmark.

Creates a separator to be used between items in a menu.

The MenuItem.Shortcut annotation recognizes a menu-item shortcut key combination in one of the following forms:

  • a Char;

  • a KeyEvent.Key; or

  • a list of modifier symbols ending with a Char or KeyEvent.Key. The following modifier symbols are allowed:

    • #'alt (Windows and Unix only)

    • #'cmd (Mac OS only)

    • #'meta (Unix only, and not combined with #'alt)

    • #'ctl

    • #'shift

    • #'option (Mac OS only)

The MenuItem.default_shortcut_prefix function returns the list of modifier symbols that is added for the current platform when just a Char or KeyEvent.Key is provided for a shortcut.