Code: Select all
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_BUTTON(ID_Of_Action_Object, MainFrame :: CalledMethod)
END_EVENT_TABLE();
btn = new wxButton(this, BUTTON_ID, "Button", wxDefaultPosition, wxDefaultSize);
btn->Connect(BUTTON_ID, wxEVT_LEFT_DOWN, wxCommandEventHandler(MyFrame::OnDown));
void MainFrame :: OnDown(wxCommandEvent& event){
//do something after clicking on the button;
};
It works if // do something is: wxMessageBox("lalala"), for example
but,
if the action is btn-SetLabel("lalala"); or other action origin in object ___ btn->SetBackgroundColour...
doesn't work. Compile is normal, but in click the button is generate a fatal error...
Thanks if someone could help me...