PushButton not subscribing
Posted: Mon Mar 21, 2005 14:48
I'm trying to put a button on the gui to start an ogre animation. The MouseEnters and Leaves events register and firing correctly, but the button push does not. Below is the code, any help would be greatly appreciated.
Code: Select all
CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"gui.xml");
mGUISystem->setGUISheet(sheet);
try
{
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
wmgr.getWindow((CeStr)"StartButton")
->subscribeEvent(
CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&MarchDemo::startAnimation, this)
);
wmgr.getWindow((CeStr)"StartButton")
->subscribeEvent(
CEGUI::Window::EventMouseEnters,
CEGUI::Event::Subscriber(&MarchDemo::handleMouseEnters, this)
);
wmgr.getWindow((CeStr)"StartButton")
->subscribeEvent(
CEGUI::Window::EventMouseLeaves,
CEGUI::Event::Subscriber(&MarchDemo::handleMouseExits, this)
);
}
catch (CEGUI::UnknownObjectException e)
{
MessageBox(NULL, e.getMessage().c_str(), "Error", MB_OK);
}
///More misc code
bool MarchDemo::startAnimation(const CEGUI::EventArgs& e)
{
MessageBox(NULL, "Button Clicked", "", MB_OK);
mController->startAnimation();
return true;
}
bool MarchDemo::handleMouseEnters(const CEGUI::EventArgs& e)
{
MessageBox(NULL, "Testing", "", MB_OK);
mController->setGUIActive(true);
return true;
}
bool MarchDemo::handleMouseExits(const CEGUI::EventArgs& e)
{
mController->setGUIActive(false);
return true;
}