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
Property | Type | Description |
---|---|---|
_ | 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. |
firstitem | wxmenuitem | This property holds a reference to the first menu item attached to the menu. |
menu | wxmenu | This property holds a reference to the menu where a submenu might be hosted. |
menubar | wxmenubar | This property holds a reference to the menubar where the menu is hosted. |
type | type | 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
,
string itemtype
,
integer label
,
wxmenu position
,
boolean submenu
,
boolean enabled
,
string checked
)
name
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
itemtype | None | string |
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. |
position | Current entry count plus one | integer | The place where the menu item is to be inserted. By default, it will be appended to the end. |
submenu | .nul | wxmenu |
Use this to insert a submenu. It can be included even when adding items as
long as it is set to .nul .
|
enabled | .true | boolean | Indicates whether the menu is enabled or disabled. |
checked | .false | boolean | Indicates whether the menuitem is checked or not. |
name | .nul | string | 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.