SIMPOL Documentation

wxmenu

Description

A wxmenu object provides a host for the various menu items and sub menus. A menu can only be used in one menu bar at a time. It also cannot be used in a menu bar and as a right-mouse pop-up menu concurrently.

Type Tags

None

Object Value

wxmenu.new()

Description

Creates a new wxmenu object.

Prototype

wxmenu.new ()

Parameters

None

Properties

PropertyTypeDescription
_type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided.
__type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property.
firstitemwxmenuitem This property holds a reference to the first menu item attached to the menu.
menuwxmenu This property holds a reference to the menu where a submenu might be hosted.
menubarwxmenubar This property holds a reference to the menubar where the menu is hosted.
typetype Specifies the wxmenu type object.

Methods

insert()

Description

Inserts a menu item (or submenu) into the menu. The wxmenu object itself is returned, to allow multiple insertion methods to be put into one expression.

Prototype

wxmenuvar.insert ( string itemtype, string label, integer position, wxmenu submenu, boolean enabled, boolean checked, string name )

Parameters
ParameterDefault valueType nameDescription
itemtypeNonestring The type of menu item being inserted. For a normal item, use the empty string (""), for a checkable item, use "checkable", for a radio item use "radio" (a radio item is one of a group of menu items, only one of which can be selected at a given time). For a separator, use "separator" and for a sub menu, use "submenu".
label""string The label for the menu item.
positionCurrent entry count plus oneinteger The place where the menu item is to be inserted. By default, it will be appended to the end.
submenu.nulwxmenu Use this to insert a submenu. It can be included even when adding items as long as it is set to .nul.
enabled.trueboolean Indicates whether the menu is enabled or disabled.
checked.falseboolean Indicates whether the menuitem is checked or not.
name.nulstring This is the name of the menu item. It is not required, but can be useful if the menu item is to be manipulated using the member (!) operator.

wxmenu!

Get

The member operator followed by the name of a menu item returns a reference to the wxmenuitem object. To access a sub menu associated with a menu item using only the menu object, the code would look like this: m!file.submenu where m is the menu object and file is the name that was assigned when the sub menu was inserted. If the name provided is not correct (including case-sensitivity), then an error will occur.

Set

Attempting to assign a reference or a value to a wxmenu object using the ! operator is not supported.