Menus
Using 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 an event for a
wxMenuItem under Linux,
this must be
a sequence where the first element is the
wxFrame to which the
wxMenuItem
belongs, and the second element is the
wxMenu to which the
wxMenuItem
belongs. Under Windows, set_event_hander() will also accept
this as
a sequence.
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_menu_label( atom menu, atom id, sequence label )
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 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 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
Insert a wxMenuItem at position in the specified menu.
Menus
Category:
Menus
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
Use to change the text of a menu item. id should be the id
of the menuitem.