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(Id, 
       Name, 
       Action, 
       HelpString = "", 
       Checkable = false)
 
Name Type Default Description
Id Integer The id of the menu item.
Name String The name of the menu item.
Action Function The function that is called when the menu item is selected. The argument to the function will be wxCommandEvent.
HelpString String Message which is shown in the statusbar.
Checkable Boolean false Indicates if the menu item can be checked or not.

Appends a new menu item to the menu.

appendSeparator

appendSeparator()
 

Adds a separator

break

break()
 

Adds a new column

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)
 
Name Type Default Description
Pos Integer
MenuItem wxMenuItem

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

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.

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.