This may seem like a repetative question, but I have already looked at all the other threads for handling events but none of them were able to help me. Anyway, I am having a hard time getting event handling to work, my button shows up along with the cursor, but nothing happens when I click the button. Here is the code I am using:
void setupEventHandling(void) {
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
wmgr.getWindow((CEGUI::utf8*)"Quit")->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&GUI::handleQuit, this));
}
bool handleQuit(const CEGUI::EventArgs& e)
{
Ogre::LogManager::getSingleton().logMessage("Quit Button Pressed");
return true;
}
Both of these functions are in a class called GUI. The events are injected in another class in another header file. My question is, does anyone know what is wrong, I personally think it is with the 'this' part of the event subscriber. Thanks in advance. Oh, and I know the log message with Ogre does work!
Event Recieving Error...
Moderators: CEGUI MVP, CEGUI Team
- me_go_fast
- Just popping in
- Posts: 1
- Joined: Sun Jan 08, 2006 18:33
- Contact:
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Event Recieving Error...
If the setupEventHandling function is not a member of the GUI class, then indeed, the 'this' is likely to be an issue. Instead of 'this' you must pass an instance of the GUI class. Having said that, the compiler should complain if that were the case.
Also make sure you're injecting both mouse up and mouse down events, and also that the button is not 'covered' by some other GUI sheet that prevents inputs getting to the button.
Does the button highlight when you hover the mouse over it? Does it's rendering change at all as you click the mouse button over it? The answers to these questions are useful in determining whether inputs are actually getting to the widget
CE.
Also make sure you're injecting both mouse up and mouse down events, and also that the button is not 'covered' by some other GUI sheet that prevents inputs getting to the button.
Does the button highlight when you hover the mouse over it? Does it's rendering change at all as you click the mouse button over it? The answers to these questions are useful in determining whether inputs are actually getting to the widget

CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: Bing [Bot] and 11 guests