back to gui 

wxMenu

generated from ../src/mod_gui/control/menu.cpp

A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes away (clicking elsewhere dismisses the menu). Menus may be used to construct either menu bars or popup menus. See wxMenuBar and menuBar property.

Constants

Styles

Name Description
TEAROFF (wxGTK only)

Constructor

wxMenu

wxMenu(Title = "", 
       Style = 0)
 
Name Type Default Description
Title String A title for the popup menu
Style Integer 0 A menu style
wxMenu(Style = 0)
 
Name Type Default Description
Style Integer 0 A menu style

Creates a new wxMenu object

Properties

Name Type Description
actions Array An array containing the function callbacks. A function will be called when a menu item is selected. Use id id as index of the array. It is possible to change the function after the menu item is appended to the menu.
menuItemCount read only Integer Returns the number of menu items.
menuItems read only Array Returns all the menu items.
title String Get/Set the title of the menu

Methods

append

append(Item) : wxMenuItem
 
Name Type Default Description
Item wxMenuItem
append(Id) : wxMenuItem
 
Name Type Default Description
Id Integer The id of the menu item.
append(Id, 
       Name, 
       HelpString = "", 
       Kind = wxItemKind.NORMAL) : wxMenuItem
 
Name Type Default Description
Id Integer The id of the menu item.
Name String The name of the menu item.
HelpString String Message which is shown in the statusbar.
Kind Integer wxItemKind.NORMAL See wxItemKind.
append(Id, 
       SubMenu, 
       HelpString = "") : wxMenuItem
 
Name Type Default Description
Id Integer The id of the menu item.
SubMenu wxMenu Pull-right submenu
HelpString String Message which is shown in the statusbar.

Appends a new menu item to the menu.

appendCheckItem

appendCheckItem(Id, 
                Item, 
                Help = "") : wxMenuItem
 
Name Type Default Description
Id Integer
Item String
Help String

Adds a checkable item to the end of the menu.

appendRadioItem

appendRadioItem(Id, 
                Item, 
                Help = "") : wxMenuItem
 
Name Type Default Description
Id Integer
Item String
Help String

Adds a radio item to the end of the menu.

appendSeparator

appendSeparator() : wxMenuItem
 

Adds a separator

appendSubMenu

appendSubMenu(Menu, 
              Item, 
              Help = "") : wxMenuItem
 
Name Type Default Description
Menu wxMenu
Item String
Help String

Adds a submenu to the end of the menu.

check

check(Id, 
      Check)
 
Name Type Default Description
Id Integer The id of the menu item.
Check Boolean Check (true) or uncheck (false) the item

Checks or unchecks the menu item.

deleteItem

deleteItem(Id)
 
Name Type Default Description
Id Integer The id of the menu item.
deleteItem(MenuItem)
 
Name Type Default Description
MenuItem wxMenuItem A menu item.

Deletes the menu item from the menu. If the item is a submenu, it will not be deleted. Use destroy if you want to delete a submenu.

destroy

destroy(Id)
 
Name Type Default Description
Id Integer The id of the menu item
destroy(MenuItem)
 
Name Type Default Description
MenuItem wxMenuItem

Deletes the menu item from the menu. If the item is a submenu, it will be deleted. Use remove if you want to keep the submenu (for example, to reuse it later).

enable

enable(Id, 
       Enable)
 
Name Type Default Description
Id Integer The id of the menu item.
Enable Boolean Enables (true) or disables (false) the item

Enables or disables the menu item.

findItem

findItem(Search) : Integer
 
Name Type Default Description
Search String The search string

Searches the menu item with the given search string and returns its identifier. -1 is returned when the item is not found. Any special menu codes are stripped out of source and target strings before matching.

getHelpString

getHelpString(Id) : String
 
Name Type Default Description
Id Integer The id of the menu item

Returns the helpstring of the menu item with the given id. See setHelpString and help property

getItem

getItem(Id) : wxMenuItem
 
Name Type Default Description
Id Integer The id of the menu item

Returns the wxMenuItem object of the menu item with the given id.

getLabel

getLabel(Id) : String
 
Name Type Default Description
Id Integer The id of the menu item

Returns the label of the menu item with the given id. See setLabel and label property.

insert

insert(Pos, 
       MenuItem) : wxMenuItem
 
Name Type Default Description
Pos Integer
MenuItem wxMenuItem
insert(Pos, 
       Id, 
       Item = "", 
       Help = "", 
       Kind = wxItemKind.NORMAL) : wxMenuItem
 
Name Type Default Description
Pos Integer
Id Integer
Item String
Help String
Kind Integer wxItemKind.NORMAL

Inserts the given item before the position pos. Inserting the item at the position menuItemCount is the same as appending it.

insertCheckItem

insertCheckItem(Pos, 
                Id, 
                Item, 
                Help = "") : wxMenuItem
 
Name Type Default Description
Pos Integer
Id Integer
Item String
Help String

insertCheckItem

insertCheckItem(Pos, 
                Id, 
                Item, 
                Help = "") : wxMenuItem
 
Name Type Default Description
Pos Integer
Id Integer
Item String
Help String

insertSeparator

insertSeparator(Pos) : wxMenuItem
 
Name Type Default Description
Pos Integer

isChecked

isChecked(Id) : Boolean
 
Name Type Default Description
Id Integer A menu item identifier.

Returns true when the menu item is checked.

isEnabled

isEnabled(Id) : Boolean
 
Name Type Default Description
Id Integer A menu item identifier.

Returns true when the menu item is enabled.

newColumn

newColumn()
 

Adds a new column

prepend

prepend(Item) : wxMenuItem
 
Name Type Default Description
Item wxMenuItem
prepend(Id, 
        Name, 
        HelpString = "", 
        Kind = wxItemKind.NORMAL) : wxMenuItem
 
Name Type Default Description
Id Integer The id of the menu item.
Name String The name of the menu item.
HelpString String Message which is shown in the statusbar.
Kind Integer wxItemKind.NORMAL See wxItemKind.

Inserts the given item at position 0, i.e. before all the other existing items.

prependCheckItem

prependCheckItem(Id, 
                 Item, 
                 Help = "") : wxMenuItem
 
Name Type Default Description
Id Integer
Item String
Help String

Inserts a checkable item at position 0.

prependRadioItem

prependRadioItem(Id, 
                 Item, 
                 Help = "") : wxMenuItem
 
Name Type Default Description
Id Integer
Item String
Help String

Adds a radio item to the end of the menu.

prependSeparator

prependSeparator() : wxMenuItem
 

Adds a separator

remove

remove(Id) : wxMenuItem
 
Name Type Default Description
Id Integer An identifier of a menu item.
remove(MenuItem) : wxMenuItem
 
Name Type Default Description
MenuItem wxMenuItem

Removes the menu item from the menu but doesn't delete the object. This allows to reuse the same item later by adding it back to the menu (especially useful with submenus).

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 and 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. See label property and setLabel method




Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.