1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| #include "StaticEventTableFrame.h"
#define BTN_ID 10021 #define BTN_2_ID 12000 BEGIN_EVENT_TABLE(StaticEventTableFrame, wxFrame) EVT_BUTTON(BTN_ID,StaticEventTableFrame::OnMyButton1) EVT_COMMAND(BTN_2_ID,wxEVT_BUTTON,StaticEventTableFrame::OnMyButton2)
END_EVENT_TABLE()
StaticEventTableFrame::StaticEventTableFrame(wxFrame *frame, const wxString& title):wxFrame(frame,wxID_ANY,title) {
wxButton* btn1 = new wxButton(this,BTN_ID,"我是按钮1",wxPoint(10,10),wxSize(100,30)); wxButton* btn2 = new wxButton(this,BTN_2_ID,"我是按钮2",wxPoint(10,10),wxSize(100,30)); wxBoxSizer* box = new wxBoxSizer(wxVERTICAL); box->Add(btn1,1,wxALL,0); box->Add(btn2,1,wxALL,0); this->SetSizer(box); }
StaticEventTableFrame::~StaticEventTableFrame() { } void StaticEventTableFrame::OnMyButton1(wxCommandEvent& event) { wxMessageBox("你点击了按钮1!!!"); } void StaticEventTableFrame::OnMyButton2(wxCommandEvent& event) { wxMessageBox("你点击了按钮2!!!"); }
|