wxMenuBar(3erl)
π
wxMenuBar (the 3erl Erlang module definition, bestie)
Okay so picture this: it's the Erlang module definition for wxMenuBar, straight out of the wxWidgets crew. This page?? Genuinely iconic. Let's get into it π«Ά
β¨ NAME β¨
wxMenuBar β literally just the functions for the wxMenuBar class. That's it, that's the vibe. π
πΈ DESCRIPTION πΈ
A menu bar is a series of menus accessible from the top of a frame. Main character energy, sitting up there at the top of your window. π
Remark: to respond to a menu selection, provide a handler for EVT_MENU, in the frame that contains the menu bar. Like, the frame is the one holding the bag here, not the bar itself. π
Also lowkey important: if you have a toolbar which uses the same identifiers as your EVT_MENU entries, events from the toolbar will also be processed by your EVT_MENU event handlers. Not a bug, just how it is, no cap.
Tip: under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu) are not working, check anyEVT_CHARevents you are handling in child windows. If you are not callingevent.Skip()for events that you don't process in these event handlers, menu shortcuts may cease to work. Genuinely a trap, bestie β don't let it happen to you π
See: wxMenu, Overview events
This class is derived (and can use functions) from: wxWindow, wxEvtHandler β so it's got that whole family tree going on π
wxWidgets docs: wxMenuBar
π¦ DATA TYPES π¦
wxMenuBar() = wx:wx_object()
Simple. Clean. Slay. β¨
π EXPORTS π
new() -> wxMenuBar()β construct an empty menu bar. A blank canvas, an empty group chat, a fresh start πnew(Style) -> wxMenuBar()β the same thing but with style, obviously.- Types:
Style = integer()
- Types:
destroy(This :: wxMenuBar()) -> okβ destructor, destroying the menu bar and removing it from the parent frame (if any). It's giving closure, honestly πappend(This, Menu, Title) -> boolean()β adds the item to the end of the menu bar.- Types:
This = wxMenuBar()Menu = wxMenu:wxMenu()Title = unicode:chardata()
- Return:
trueon success,falseif an error occurred. - See:
insert/4
- Types:
check(This, Id, Check) -> okβ checks or unchecks a menu item.- Types:
This = wxMenuBar()Id = integer()Check = boolean()
- > Remark: only use this when the menu bar has been associated with a frame; otherwise, use the
wxMenuequivalent call. Fr fr, read the room π
- Types:
enable(This, Id, Enable) -> okβ enables or disables (greys out) a menu item. The greying out is so real.- Types:
This = wxMenuBar()Id = integer()Enable = boolean()
- > Remark: only use this when the menu bar has been associated with a frame; otherwise, use the
wxMenuequivalent call.
- Types:
enableTop(This, Pos, Enable) -> okβ enables or disables a whole menu. All of it. Wholesale.- Types:
This = wxMenuBar()Pos = integer()Enable = boolean()
- > Remark: only use this when the menu bar has been associated with a frame.
- Types:
findMenu(This, Title) -> integer()β returns the index of the menu with the given title orwxNOT_FOUNDif no such menu exists in this menubar.- Types:
This = wxMenuBar()Title = unicode:chardata()
- The
Titleparameter may specify either the menu title (with accelerator characters, i.e."&File") or just the menu label ("File") indifferently. Flexible queen π
- Types:
findMenuItem(This, MenuString, ItemString) -> integer()β finds the menu item id for a menu name/menu item string pair.- Types:
This = wxMenuBar()MenuString = ItemString = unicode:chardata()
- Return: the menu item identifier, or
wxNOT_FOUNDif none was found. - > Remark: any special menu codes are stripped out of source and target strings before matching. Sneaky but fair π§
- Types:
findItem(This, Id) -> wxMenuItem:wxMenuItem()β finds the menu item object associated with the given menu item identifier.- Types:
This = wxMenuBar()Id = integer()
- Return: the found menu item object, or
NULLif one was not found.
- Types:
getHelpString(This, Id) -> unicode:charlist()β gets the help string associated with the menu item identifier.- Types:
This = wxMenuBar()Id = integer()
- Return: the help string, or the empty string if there was no help string or the menu item was not found.
- See:
setHelpString/3
- Types:
getLabel(This, Id) -> unicode:charlist()β gets the label associated with a menu item.- Types:
This = wxMenuBar()Id = integer()
- 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.
- Types:
getLabelTop(This, Pos) -> unicode:charlist()β seegetMenuLabel/2. That's the whole description, she's mysterious π- Types:
This = wxMenuBar()Pos = integer()
- Types:
getMenuLabel(This, Pos) -> unicode:charlist()β returns the label of a top-level menu.- Types:
This = wxMenuBar()Pos = integer()
- 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
- Types:
getMenuLabelText(This, Pos) -> unicode:charlist()β returns the label of a top-level menu.- Types:
This = wxMenuBar()Pos = integer()
- Note that the returned string does not include any accelerator characters that may have been specified in the menu title string during its construction. (Yes, this is the opposite of
getMenuLabel/2. They're sisters, not twins π«Ά) - 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
- Types:
getMenu(This, MenuIndex) -> wxMenu:wxMenu()β returns the menu atMenuIndex(zero-based). Zero-based indexing, my beloved π- Types:
This = wxMenuBar()MenuIndex = integer()
- Types:
getMenuCount(This) -> integer()β returns the number of menus in this menubar. Counting is self care β¨- Types:
This = wxMenuBar()
- Types:
insert(This, Pos, Menu, Title) -> boolean()β inserts the menu at the given position into the menu bar.- Types:
This = wxMenuBar()Pos = integer()Menu = wxMenu:wxMenu()Title = unicode:chardata()
- Inserting menu at position
0will insert it in the very beginning of it, inserting at positiongetMenuCount/1is the same as callingappend/3. So like, the edges are the same edges π - Return:
trueon success,falseif an error occurred. - See:
append/3
- Types:
isChecked(This, Id) -> boolean()β determines whether an item is checked.- Types:
This = wxMenuBar()Id = integer()
- Return:
trueif the item was found and is checked,falseotherwise.
- Types:
setAutoWindowMenu(Enable) -> okβ sets the auto window menu. No further notes, she's concise.- Types:
Enable = boolean()
- Types:
getAutoWindowMenu() -> boolean()β gets the auto window menu. Also concise. Matching set πoSXGetAppleMenu(This) -> wxMenu:wxMenu()β returns the Apple menu.- Types:
This = wxMenuBar()
- 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. Respect her boundaries and she'll respect yours π
- Only for:
wxosx - Since:
3.0.1
- Types:
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. Sorry to everyone else π
- Only for:
wxosx
macSetCommonMenuBar(Menubar) -> okβ enables you to set the global menubar on Mac, that is, the menubar displayed when the app is running without any frames open.- Types:
Menubar = wxMenuBar()
- > Remark: only exists on Mac, other platforms do not have this method. Again. Mac exclusive π§
- Only for:
wxosx
- Types:
isEnabled(This, Id) -> boolean()β determines whether an item is enabled.- Types:
This = wxMenuBar()Id = integer()
- Return:
trueif the item was found and is enabled,falseotherwise.
- Types:
remove(This, Pos) -> wxMenu:wxMenu()β removes the menu from the menu bar and returns the menu object β the caller is responsible for deleting it. Yes, you. It's your problem now π- Types:
This = wxMenuBar()Pos = integer()
- This function may be used together with
insert/4to change the menubar dynamically. Glow-up in real time π« - See:
replace/4
- Types:
replace(This, Pos, Menu, Title) -> wxMenu:wxMenu()β replaces the menu at the given position with another one. Out with the old, in with the new.- Types:
This = wxMenuBar()Pos = integer()Menu = wxMenu:wxMenu()Title = unicode:chardata()
- Return: the menu which was previously at position
pos. The caller is responsible for deleting it. Same deal asremove/2, bestie π«Ά - See:
insert/4,remove/2
- Types:
setHelpString(This, Id, HelpString) -> okβ sets the help string associated with a menu item.- Types:
This = wxMenuBar()Id = integer()HelpString = unicode:chardata()
- See:
getHelpString/2
- Types:
setLabel(This, Id, Label) -> okβ sets the label of a menu item.- Types:
This = wxMenuBar()Id = integer()Label = unicode:chardata()
- > Remark: use only after the menubar has been associated with a frame.
- See:
getLabel/2
- Types:
setLabelTop(This, Pos, Label) -> okβ seesetMenuLabel/3. Short and sweet π- Types:
This = wxMenuBar()Pos = integer()Label = unicode:chardata()
- Types:
setMenuLabel(This, Pos, Label) -> okβ sets the label of a top-level menu.- Types:
This = wxMenuBar()Pos = integer()Label = unicode:chardata()
- > Remark: use only after the menubar has been associated with a frame.
- Types:
And that's the whole page, bestie β no skips, no cap, every flag accounted for π
Later, babes βοΈ β this one's brought to you by the wxWidgets team, running wx 2.2.2.1, and it's the wxMenuBar(3erl) page, mwah π
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms