Table of Contents

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:

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.

  • 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 )   Using menus
  • 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:
  • wxMenu
  • wxMenuBar
  • wxMenuItem


    Table of Contents

    [proc]
    check_menuitem
    ( atom menuitem, integer check )

    Category: Menus

    If check is 0, then the menuitem is unchecked. If check is 1, then the menuitem is checked.

    See Also: enable_menuitem, get_menuevent_id, get_menuitem_id, insert_menuitem, is_menuitem_checked, remove_menuitem, set_menu_label



    Table of Contents

    [proc]
    enable_menuitem
    ( atom menuitem, integer enable )

    Category: Menus

    1 enables a menuitem, 0 disables.

    See Also: check_menuitem, get_menuevent_id, get_menuitem_id, insert_menuitem, is_menuitem_checked, remove_menuitem, set_menu_label



    Table of Contents

    [func]
    get_menuevent_id
    ( atom event )

    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.

    See Also: check_menuitem, enable_menuitem, get_menuitem_id, insert_menuitem, is_menuitem_checked, remove_menuitem, set_menu_label



    Table of Contents

    [func]
    get_menuitem_id
    ( atom item )

    Using 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.

    See Also: check_menuitem, enable_menuitem, get_menuevent_id, insert_menuitem, is_menuitem_checked, remove_menuitem, set_menu_label



    Table of Contents

    [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.

    See Also: check_menuitem, enable_menuitem, get_menuevent_id, get_menuitem_id, is_menuitem_checked, remove_menuitem, set_menu_label



    Table of Contents

    [func]
    is_menuitem_checked
    ( atom menuitem )

    Category: Menus

    Returns 1 if the menuitem is checked, 0 otherwise.

    See Also: check_menuitem, enable_menuitem, get_menuevent_id, get_menuitem_id, insert_menuitem, remove_menuitem, set_menu_label



    Table of Contents

    [proc]
    remove_menuitem
    ( atom menu, atom item )

    Category: Menus

    Removes a wxMenuItem from a wxMenu and deletes the wxMenuItem.

    See Also: check_menuitem, enable_menuitem, get_menuevent_id, get_menuitem_id, insert_menuitem, is_menuitem_checked, set_menu_label



    Table of Contents

    [proc]
    set_menu_label
    ( atom menu, atom id, sequence label )

    Category: Menus

    Use to change the text of a menu item. id should be the id of the menuitem.

    See Also: check_menuitem, enable_menuitem, get_menuevent_id, get_menuitem_id, insert_menuitem, is_menuitem_checked, remove_menuitem