wxMenuItem

wxMenuItem
wxMenuItems must have a wxMenu parent.

Creation Parameters

If specifying a bitmap, you can also specify a width and height to rescale the image. You may also specify a quality to use during the rescaling.

To create a submenu, you first need to create a wxMenu with no parent, and pass the result in the subMenu parameter.

To set up event handlers for menus, use the wxEVT_COMMAND_MENU_SELECTED event type. wxMenu controls now derive from wxEvtHandler, so you should set events with the menu now, not a parent control.

Example:

    procedure on_open_menu( atom this, atom event, atom id, atom event_type )
        -- do stuff
    end procedure

    -- if you used a specific wxID_ constant when you created the wxMenuItem, you could
    -- use that instead of get_menuitem_id: wxID_OPEN, wxID_NEW, etc

    set_event_handler( the_open_menu_parent, get_menuitem_id( the_open_menu ),
        wxEVT_COMMAND_MENU_SELECTED, routine_id("on_open_menu"))
Supertopics