I've been trying to dev with wxWidgets. This afternoon I started playing with wxFormBuilder and XRC files.
I can load frames just fine, but when I start trying to use XRCCTRL to load a button and bind to an event like the tutorial shows I get an error:
.expression must have class type
Code is
Code: Select all
#include "cApp.h"
#include "wx/xrc/xmlres.h"
wxIMPLEMENT_APP(cApp);
bool cApp::OnInit()
{
//m_frame1 = new cMain();
//m_frame1->Show();
wxXmlResource::Get()->InitAllHandlers();
wxXmlResource::Get()->Load("ressources/noname.xrc");
wxFrame* MainFrame = wxXmlResource::Get()->LoadFrame(NULL, "MyFrame3");
if (!MainFrame) {
wxLogError("Failed to load the main frame from the resources.");
return false;
}
XRCCTRL(MainFrame, "clickme_btn", wxButton)->Bind(wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(MyClass::OnClickme), this, XRCID("clickme_btn"));
MainFrame->Show();
return true;
}
Thanks in advance!
edit: Adding the error in the body of the post.