wx菜单栏

#include "MainFrame.h"

BEGIN_EVENT_TABLE(MyFrame,wxFrame)
    EVT_MENU(wxID_FILE,MyFrame::OnMenuEvt)
END_EVENT_TABLE()


MyFrame::MyFrame(const wxString& title)
    : wxFrame(NULL, wxID_ANY, title)
{
    wxMenu *FileMenu=new wxMenu;
    FileMenu->Append(wxID_FILE,wxT("1first"));
    FileMenu->Append(wxID_FILE1,wxT("1second"));

    wxMenu *HelpMenu=new wxMenu;
    HelpMenu->Append(wxID_HELP,wxT("2first"));

    wxMenuBar *MenuBar=new wxMenuBar;
    MenuBar->Append(FileMenu,wxT("File"));
    MenuBar->Append(HelpMenu,wxT("Help"));

    SetMenuBar(MenuBar);
    
}

void MyFrame::OnMenuEvt(wxCommandEvent &event)
{
    wxMessageBox("menu event");
}

 

你可能感兴趣的:(wx菜单栏)