CEGUI - assigning an event to a button

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

Stenr Reisa
Just popping in
Just popping in
Posts: 12
Joined: Sun Aug 26, 2012 01:13

CEGUI - assigning an event to a button

Postby Stenr Reisa » Sun Aug 26, 2012 01:17

I am attempting to integrate CEGUI into the advanced ogre framework example that is on their site. I have gotten to the point where I am trying to assign an event to happen when a button is clicked, and I am having trouble with this line:

Code: Select all

quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&AppState::shutdown, this));


When I try to compile this, I get the error:

Code: Select all

1>c:\users\stenr\basics\xxx\projects\development\client\xxx\xxx\menustate.cpp(46): error C2661: 'CEGUI::SubscriberSlot::SubscriberSlot' : no overloaded function takes 2 arguments


Can anyone help me out here? What is it I have done wrong? Was pretty much smooth sailing up till here, buttons and everything show up, I just can't get the event to apply to the button for some reason. :oops: Any help is greatly appreciated!

MorbidAngel
Just popping in
Just popping in
Posts: 18
Joined: Sat Aug 04, 2012 16:35

Re: CEGUI - assigning an event to a button

Postby MorbidAngel » Sun Aug 26, 2012 12:47

Declare your shutdown event function as so:

bool shutdown(const CEGUI::EventArgs& e);

Stenr Reisa
Just popping in
Just popping in
Posts: 12
Joined: Sun Aug 26, 2012 01:13

Re: CEGUI - assigning an event to a button

Postby Stenr Reisa » Sun Aug 26, 2012 19:42

Yup, that was it, thanks!

Stenr Reisa
Just popping in
Just popping in
Posts: 12
Joined: Sun Aug 26, 2012 01:13

Re: CEGUI - assigning an event to a button

Postby Stenr Reisa » Sun Aug 26, 2012 21:32

Well, actually now I have declared the function in that way and am still getting the error...what could be causing that? Here's relevant things

Code: Select all

quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&DemoApp::stopDemo, this));


Code: Select all

bool DemoApp::stopDemo(const CEGUI::EventArgs& e)
{
   OgreFramework::getSingletonPtr()->m_pLog->logMessage("Demo stopped!");
   m_pAppStateManager->popAllState();

   return true;
}


Here's the part of the log I am supposed to post:
25/08/2012 19:06:46 (Std) ---- Version 0.7.6 (Build: May 30 2012 Debug Microsoft Windows MSVC++ 10.0 32 bit) ----
25/08/2012 19:06:46 (Std) ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
25/08/2012 19:06:46 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
25/08/2012 19:06:46 (Std) ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
25/08/2012 19:06:46 (Std) ---- Scripting module is: None ----

Stenr Reisa
Just popping in
Just popping in
Posts: 12
Joined: Sun Aug 26, 2012 01:13

Re: CEGUI - assigning an event to a button

Postby Stenr Reisa » Mon Aug 27, 2012 00:52

I'm trying something different, what would be an eventarg that I would pass to the function? I was thinking it would be like a specific button mouseclick or a specific keypress. Am I wrong?

Stenr Reisa
Just popping in
Just popping in
Posts: 12
Joined: Sun Aug 26, 2012 01:13

Re: CEGUI - assigning an event to a button

Postby Stenr Reisa » Mon Aug 27, 2012 01:03

OK nevermind i figured it out :lol: :lol: :lol: thanks!


Return to “Help”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 6 guests