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");
}

 

posted @ 2017-08-27 17:01  Dsp Tian  阅读(700)  评论(0编辑  收藏  举报