wxMenuBar(3)

๐Ÿ“ฆ
version 29.0.6 ยท 3 versions
, in ubuntu stonking

๐Ÿ’– NAME ๐Ÿ’–

wxMenuBar โ€” it's the Erlang module definition for a menu bar, which (bestie, listen) is literally just a series of menus hanging out at the top of a frame. Main character energy up there. ๐Ÿ‘‘


๐ŸŒธ DESCRIPTION ๐ŸŒธ

Remark: to actually respond to a menu selection, you gotta provide a handler for EVT_MENU, in the frame that contains the menu bar. no handler, no vibes, no response.

If you have a toolbar which uses the same identifiers as your EVT_MENU entries, then events from the toolbar will also be processed by your EVT_MENU event handlers. lowkey sneaky of it but ok.

Tip: under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu) are not working, go check any EVT_CHAR events you are handling in child windows. If you are not calling event.Skip() for events that you don't process in these event handlers, menu shortcuts may cease to work. that's the whole glitch, bestie. ๐Ÿซ 

See:

  • wxMenu
  • Overview events

This class is derived, and can use functions, from:

  • wxWindow
  • wxEvtHandler

wxWidgets docs: wxMenuBar


๐ŸŽ€ DATA TYPES ๐ŸŽ€

wxMenuBar() :: wx:wx_object().

โœจ FUNCTIONS โœจ

append(This, Menu, Title) -> boolean()

when
    This :: wxMenuBar(),
    Menu :: wxMenu:wxMenu(),
    Title :: unicode:chardata().

Adds the item to the end of the menu bar. just yeet it on the end, periodt. ๐Ÿ’…

Return: true on success, false if an error occurred.

See: insert/4


check(This, Id, Check) -> ok

when
    This :: wxMenuBar(),
    Id :: integer(),
    Check :: boolean().

Checks or unchecks a menu item. the little ticky mark, iconic.

Remark: Only use this when the menu bar has been associated with a frame; otherwise, use the wxMenu equivalent call.

destroy(This :: wxMenuBar()) -> ok.

Destroys the object. bye bestie ๐Ÿฆ‹


enable(This, Id, Enable) -> ok

when
    This :: wxMenuBar(),
    Id :: integer(),
    Enable :: boolean().

Enables or disables (greys out) a menu item. greying it out is giving "not today". ๐Ÿฉถ

Remark: Only use this when the menu bar has been associated with a frame; otherwise, use the wxMenu equivalent call.

enableTop(This, Pos, Enable) -> ok

when
    This :: wxMenuBar(),
    Pos :: integer(),
    Enable :: boolean().

Enables or disables a whole menu. not a single item, the entire menu, ok? ๐ŸŒˆ

Remark: Only use this when the menu bar has been associated with a frame.

findItem(This, Id) -> wxMenuItem:wxMenuItem()

when This :: wxMenuBar(), Id :: integer().

Finds the menu item object associated with the given menu item identifier.

Return: The found menu item object, or NULL if one was not found. ๐Ÿ˜ญ


findMenu(This, Title) -> integer()

when This :: wxMenuBar(), Title :: unicode:chardata().

Returns the index of the menu with the given title, or wxNOT_FOUND if no such menu exists in this menubar.

The Title parameter may specify either the menu title (with accelerator characters, i.e. "&File") or just the menu label ("File") indifferently. either one, she's flexible. ๐Ÿ’–


findMenuItem(This, MenuString, ItemString) -> integer()

when
    This :: wxMenuBar(),
    MenuString :: unicode:chardata(),
    ItemString :: unicode:chardata().

Finds the menu item id for a menu name / menu item string pair.

Return: The menu item identifier, or wxNOT_FOUND if none was found.

Remark: Any special menu codes are stripped out of source and target strings before matching. gone, deleted, not even a trace. ๐Ÿ’€

getAutoWindowMenu() -> boolean().

(no description given, she's mysterious like that โœจ)


getHelpString(This, Id) -> unicode:charlist()

when This :: wxMenuBar(), Id :: integer().

Gets the help string associated with the menu item identifier.

Return: The help string, or the empty string if there was no help string or the menu item was not found.

See: setHelpString/3


getLabel(This, Id) -> unicode:charlist()

when This :: wxMenuBar(), Id :: integer().

Gets the label associated with a menu item.

Return: The menu item label, or the empty string if the item was not found.

Remark: Use only after the menubar has been associated with a frame.

getLabelTop(This, Pos) -> unicode:charlist()

when This :: wxMenuBar(), Pos :: integer().

Equivalent to: getMenuLabel/2


getMenu(This, MenuIndex) -> wxMenu:wxMenu()

when This :: wxMenuBar(), MenuIndex :: integer().

Returns the menu at MenuIndex (zero-based). counting from zero, always, that's the deal. ๐Ÿ”ข


getMenuCount(This) -> integer()

when This :: wxMenuBar().

Returns the number of menus in this menubar.


getMenuLabel(This, Pos) -> unicode:charlist()

when This :: wxMenuBar(), Pos :: integer().

Returns the label of a top-level menu.

Note that the returned string includes the accelerator characters that have been specified in the menu title string during its construction.

Return: The menu label, or the empty string if the menu was not found.

Remark: Use only after the menubar has been associated with a frame.

See:

  • getMenuLabelText/2
  • setMenuLabel/3

getMenuLabelText(This, Pos) -> unicode:charlist()

when This :: wxMenuBar(), Pos :: integer().

Returns the label of a top-level menu.

Note that the returned string does not include any accelerator characters that may have been specified in the menu title string during its construction. so close to getMenuLabel/2 yet so different. ๐Ÿ™ˆ

Return: The menu label, or the empty string if the menu was not found.

Remark: Use only after the menubar has been associated with a frame.

See:

  • getMenuLabel/2
  • setMenuLabel/3

insert(This, Pos, Menu, Title) -> boolean()

when
    This :: wxMenuBar(),
    Pos :: integer(),
    Menu :: wxMenu:wxMenu(),
    Title :: unicode:chardata().

Inserts the menu at the given position into the menu bar.

Inserting menu at position 0 will insert it in the very beginning of it, inserting at position getMenuCount/1 is the same as calling append/3. math is math. ๐Ÿงฎ

Return: true on success, false if an error occurred.

See: append/3


isChecked(This, Id) -> boolean()

when This :: wxMenuBar(), Id :: integer().

Determines whether an item is checked.

Return: true if the item was found and is checked, false otherwise.


isEnabled(This, Id) -> boolean()

when This :: wxMenuBar(), Id :: integer().

Determines whether an item is enabled.

Return: true if the item was found and is enabled, false otherwise.


macGetCommonMenuBar() -> wxMenuBar().

Enables you to get the global menubar on Mac, that is, the menubar displayed when the app is running without any frames open.

Return: The global menubar.

Remark: Only exists on Mac, other platforms do not have this method.

Only for: wxosx ๐ŸŽ


macSetCommonMenuBar(Menubar) -> ok

when Menubar :: wxMenuBar().

Enables you to set the global menubar on Mac, that is, the menubar displayed when the app is running without any frames open.

Remark: Only exists on Mac, other platforms do not have this method.

Only for: wxosx ๐ŸŽ


new() -> wxMenuBar().

Construct an empty menu bar. a blank canvas, bestie, start decorating. ๐ŸŽจ


new(Style) -> wxMenuBar()

when Style :: integer().

(no description given, just vibes)


oSXGetAppleMenu(This) -> wxMenu:wxMenu()

when This :: wxMenuBar().

Returns the Apple menu.

This is the leftmost menu with application's name as its title. You shouldn't remove any items from it, but it is safe to insert extra menu items or submenus into it. look but don't touch (too much). ๐ŸŽ

Only for: wxosx

Since: 3.0.1


remove(This, Pos) -> wxMenu:wxMenu()

when This :: wxMenuBar(), Pos :: integer().

Removes the menu from the menu bar and returns the menu object โ€” the caller is responsible for deleting it. that's on you, not on her. ๐Ÿซต

This function may be used together with insert/4 to change the menubar dynamically.

See: replace/4


replace(This, Pos, Menu, Title) -> wxMenu:wxMenu()

when
    This :: wxMenuBar(),
    Pos :: integer(),
    Menu :: wxMenu:wxMenu(),
    Title :: unicode:chardata().

Replaces the menu at the given position with another one. swap, slay, done. ๐Ÿ”„

Return: The menu which was previously at position Pos. The caller is responsible for deleting it.

See:

  • insert/4
  • remove/2

setAutoWindowMenu(Enable) -> ok

when Enable :: boolean().

(no description given, she's keeping it lowkey โœจ)


setHelpString(This, Id, HelpString) -> ok

when
    This :: wxMenuBar(),
    Id :: integer(),
    HelpString :: unicode:chardata().

Sets the help string associated with a menu item.

See: getHelpString/2


setLabel(This, Id, Label) -> ok

when
    This :: wxMenuBar(),
    Id :: integer(),
    Label :: unicode:chardata().

Sets the label of a menu item.

Remark: Use only after the menubar has been associated with a frame.

See: getLabel/2


setLabelTop(This, Pos, Label) -> ok

when
    This :: wxMenuBar(),
    Pos :: integer(),
    Label :: unicode:chardata().

Equivalent to: setMenuLabel/3


setMenuLabel(This, Pos, Label) -> ok

when
    This :: wxMenuBar(),
    Pos :: integer(),
    Label :: unicode:chardata().

Sets the label of a top-level menu.

Remark: Use only after the menubar has been associated with a frame.

that's the whole page, bestie, you ate it up ๐Ÿ’…โœจ this little gem was brought to you by Ericsson AB, wx version 2.6, dated right there in the footer at wxMenuBar(3). go forth and build menu bars, no cap. ๐Ÿฆ‹๐ŸŽ€๐Ÿ’–

๐Ÿ“ฆ where this page comes from