wxMenuBar
generated from ../src/mod_gui/control/menubar.cppA menu bar is a series of menus accessible from the top of a frame. See menuBar property, wxMenu and wxMenuItem.
Constants
Styles
| Name | Description |
|---|---|
| DOCKABLE | (wxGTK only) |
Constructor
wxMenuBar
wxMenuBar(Style = 0)
| Name | Type | Default | Description |
|---|---|---|---|
| Style | Integer | 0 |
Constructs a new wxMenuBar object.
Properties
| Name | Type | Description |
|---|---|---|
menuCount ![]() |
Integer | The number of menus |
menus ![]() |
Array | Returns all the menus belonging to the menubar. |
Methods
append
append(Menu,
Name)
| Name | Type | Default | Description |
|---|---|---|---|
| Menu | wxMenu | ||
| Name | String |
Adds the menu to the menubar
check
check(Id,
Switch)
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | The menu item identifier | |
| Switch | Boolean | If true, checks the menu item, otherwise the item is unchecked |
Checks/Unchecks the menu with the given id. Only use this when the menu bar has been associated with a wxFrame; otherwise, use the wxMenu equivalent call.
enable
enable(Id,
Switch)
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | The menu item identifier | |
| Switch | Boolean | If true, enables the menu item, otherwise the item is disabled |
Enables/Disables the menu with the given id. Only use this when the menu bar has been associated with a wxFrame; otherwise, use the wxMenu equivalent call.
enableTop
enableTop(Pos,
Switch)
| Name | Type | Default | Description |
|---|---|---|---|
| Pos | Integer | The position of the menu, starting from zero | |
| Switch | Boolean | If true, enables the menu, otherwise the menu is disabled |
Enables or disables a whole menu. Only use this when the menu bar has been associated with a wxFrame.
findMenu
findMenu(Name) : Integer
| Name | Type | Default | Description |
|---|---|---|---|
| Name | String | The name of the menu |
Returns the index of the menu with the given name. -1 is returned when the menu is not found.
findMenuItem
findMenuItem(MenuName,
ItemName) : Integer
| Name | Type | Default | Description |
|---|---|---|---|
| MenuName | String | The name of the menu | |
| ItemName | String | The name of the menuitem. |
Finds the menu item id for a menu name/menu item string pair. -1 is returned when nothing is found.
getHelpString
getHelpString(Id) : String
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | A menu item identifier. |
Returns the helpstring associated with the menu item or an empty String when the menu item is not found. See help property and getHelpString method.
getLabel
getLabel(Id) : String
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | A menu item identifier. |
Returns the label associated with the menu item or an empty String when the menu item is not found. Use only after the menubar has been associated with a wxFrame.
getLabelTop
getLabelTop(Index) : String
| Name | Type | Default | Description |
|---|---|---|---|
| Index | Integer | Position of the menu on the menu bar, starting from zero. |
Returns the menu label, or the empty string if the menu was not found. Use only after the menubar has been associated with a wxFrame. See also title and setLabelTop
getMenu
getMenu(Index) : wxMenu
| Name | Type | Default | Description |
|---|---|---|---|
| Index | Integer |
Returns the wxMenu at the given index (zero-indexed).
insert
insert(Pos,
Menu,
Title) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Pos | Integer | The position of the new menu in the menu bar | |
| Menu | wxMenu | The menu to add. | |
| Title | String | The title of the menu. |
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 menuCount is the same as calling append.
isChecked
isChecked(Id) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | A menu item identifier. |
Returns true when the menu item is checked. See check method, isChecked and check property.
isEnabled
isEnabled(Id) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | A menu item identifier. |
Returns true when the menu item is enabled. enable method, enable property and enable
refresh
refresh()
Redraw the menu bar.
remove
remove(Index) : Boolean
| Name | Type | Default | Description |
|---|---|---|---|
| Index | Integer | The index of the menu to remove (zero-indexed). |
Removes the menu from the menu bar and returns the wxMenu object. This function may be used together with insert to change the menubar dynamically.
replace
replace(Index,
Menu,
Title) : wxMenu
| Name | Type | Default | Description |
|---|---|---|---|
| Index | Integer | The index of the menu to replace (zero-indexed). | |
| Menu | wxMenu | The new menu | |
| Title | String | The title of the menu |
Replaces the menu at the given position with the new one.
setHelpString
setHelpString(Id,
Help)
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | A menu item identifier. | |
| Help | String | The help text |
Sets the help associated with a menu item. See help property, setHelpString method
setLabel
setLabel(Id,
Label)
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | A menu item identifier. | |
| Label | String | A new label |
Sets the label of a menu item. Only use this when the menubar is associated with a wxFrame label property, setLabel method
setLabelTop
setLabelTop(Index,
Label)
| Name | Type | Default | Description |
|---|---|---|---|
| Index | Integer | A menu index (zero-indexed) | |
| Label | String | A label for a menu |
Sets the label of a menu. Only use this when the menubar is associated with a wxFrame See title property

© 2002 - 2007 Franky Braem.