Menus
Using menus
requires you to create at least three objects:
wxMenuBar,
wxMenu and
wxMenuItem.
The wxMenuBar is child to the wxFrame of your application. The wxMenuBar can have multiple
wxMenu children, and each wxMenu can have multiple wxMenuItem children.
Menu Events
- wxEVT_COMMAND_MENU_SELECTED
- wxEVT_MENU_CHAR
- wxEVT_MENU_INIT
- wxEVT_MENU_HIGHLIGHT
- wxEVT_POPUP_MENU_INIT
When setting a
wxEVT_COMMAND_MENU_SELECTED event, you should pass the pointer to the
wxMenu parent
of the
wxMenuItem.
Use of the { wxFrame, wxMenu } parameter is deprecated, and should not be used on any platform.
Functions/Procedures
- proc check_menuitem( atom menuitem, integer check )
- proc enable_menuitem( atom menuitem, integer enable )
- func get_menuevent_id( atom event )
- func get_menuitem_id( atom item )
- func insert_menuitem( atom menu, integer position, atom id, sequence text, sequence help, integer checkable )
- func is_menuitem_checked( atom menuitem )
- proc remove_menuitem( atom menu, atom item )
- proc set_menuitem_bitmap( atom item, atom bitmap )
- proc set_menu_label( atom menu, atom id, sequence label_text )
Subtopics
Menus
Category:
Menus
If check is 0, then the menuitem is unchecked. If check is 1,
then the menuitem is checked.
Menus
Category:
Menus
1 enables a menuitem, 0 disables.
Menus
Category:
Menus
Returns: MenuItem ID
Returns the id of the wxMenuItem that generated the event. This should only be
called from within a wxEVT_COMMAND_MENU_SELECTED event procedure.
Menus
Category:
Menus
Returns: Menu ID
Returns the id for a wxMenuItem. Since wxMenuItem is not derived from wxWindow,
you should never use get_id() with a wxMenuItem.
Menus
[func]
insert_menuitem ( atom menu, integer position, atom id, sequence text, sequence help, integer checkable )
Category:
Menus
Returns: True or false
Insert a wxMenuItem at position in the specified menu.
Menus
Category:
Menus
Returns: Checked state of the MenuItem
Returns 1 if the menuitem is checked, 0 otherwise.
Menus
Category:
Menus
Removes a wxMenuItem from a wxMenu and deletes the wxMenuItem.
Menus
Category:
Menus
Menus
[proc]
set_menu_label ( atom menu, atom id, sequence label_text )
Category:
Menus
Use to change the text of a menu item. id should be the id
of the menuitem.