Event Recieving Error...

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
me_go_fast
Just popping in
Just popping in
Posts: 1
Joined: Sun Jan 08, 2006 18:33
Contact:

Event Recieving Error...

Postby me_go_fast » Sat Jan 21, 2006 05:21

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!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Event Recieving Error...

Postby CrazyEddie » Sat Feb 04, 2006 20:53

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.


Return to “Help”

Who is online

Users browsing this forum: Bing [Bot] and 11 guests