i am struggling to dynamically create the event and attach it to my button,
i have tried quite a few different methods but cant seem to get them to work
with my beginner code and was hoping someone can show me what i am doing wrong.
Header
Code: Select all
#include <wx\wx.h>
class Amazing : public wxApp
{
public : virtual bool OnInit();
};
DECLARE_APP(Amazing);
Code: Select all
#include "Amazing.h"
IMPLEMENT_APP(Amazing);
bool Amazing::OnInit()
{
wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxString("Title"), wxPoint(wxDefaultPosition), wxSize(0, 0), wxBORDER_NONE);
wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
wxButton *btnexit = new wxButton(frame, wxID_EXIT, "Exit App");
btnexit->Bind(wxEVT_MENU, wxCommandEvent& event, frame->Close(true), wxID_EXIT);
sizer->AddStretchSpacer();
sizer->Add(btnexit);
sizer->AddStretchSpacer();
frame->SetSizerAndFit(sizer);
frame->Center();
frame->Show();
return true;
};
Thanks.