[SOLVED] illegal operation on bound member function

MindCalamity

08-08-2011 00:34:47

The title is a letter short, but you'll understand it, now, a few more details.

I compiled and managed to integrate MyGUI with my application, but now I want to set a event trigger to the button I'm trying to put in my app, this is the whole MyGUI code:

void App::setupUI()
{
MyGUI::OgrePlatform* mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(mWindow, mSceneMgr);
mGUI = new MyGUI::Gui();
mGUI->initialise();
MyGUI::PointerManager::getInstancePtr()->setVisible(false);
MyGUI::ResourceManager::getInstance().load("MyGUI_BlackBlueTheme.xml");
MyGUI::ButtonPtr button = mGUI->createWidget<MyGUI::Button>("Button", 10, 10, 300, 26, MyGUI::Align::Default, "Main", "Quit Button");
button->setCaption("Quit");
button->eventMouseButtonClick += MyGUI::newDelegate(&App::quit);

}


This is the only error I get:

1>src\UltraGrid.cpp(605): error C2276: '&' : illegal operation on bound member function expression

I tried putting it like this:
button->eventMouseButtonClick += MyGUI::newDelegate(quit);
or
button->eventMouseButtonClick += MyGUI::newDelegate(&quit);

But none of it worked...

This is the function quit:


void App::quit(MyGUI::WidgetPtr _sender)
{
//stopPhysics();
mShutDown = true;
}


and in my class App:

protected:
virtual void quit(MyGUI::WidgetPtr _sender);


Help !

Altren

08-08-2011 07:29:41

MyGUI::newDelegate(this, &App::quit);

MindCalamity

08-08-2011 16:54:38

MyGUI::newDelegate(this, &App::quit);

I wonder how I missed that :D

Solved.