Compiling error on PushButton::EventClicked callback

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

Hedgehog
Just popping in
Just popping in
Posts: 13
Joined: Sat Apr 18, 2009 13:22

Compiling error on PushButton::EventClicked callback

Postby Hedgehog » Sat Apr 25, 2009 16:59

Hey.

When I try to create a callback event for a button, like this:

Code: Select all

newGame->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&BufferedInputHandler::newGame));


I get this compiling error:

Code: Select all

1>------ Build started: Project: herbert_game, Configuration: Debug Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
1>herbert_game.cpp
1>c:\ogresdk\include\cegui\ceguifunctorcopyslot.h(51) : error C2064: term does not evaluate to a function taking 1 arguments
1>        c:\ogresdk\include\cegui\ceguifunctorcopyslot.h(50) : while compiling class template member function 'bool CEGUI::FunctorCopySlot<T>::operator ()(const CEGUI::EventArgs &)'
1>        with
1>        [
1>            T=bool (__thiscall BufferedInputHandler::* )(void)
1>        ]
1>        c:\ogresdk\include\cegui\ceguisubscriberslot.h(126) : see reference to class template instantiation 'CEGUI::FunctorCopySlot<T>' being compiled
1>        with
1>        [
1>            T=bool (__thiscall BufferedInputHandler::* )(void)
1>        ]
1>        c:\documents and settings\simon bakkevig\mine dokumenter\skole\hovedoppgave 08-09\herbert_game\herbert_game\include\framelistener.h(71) : see reference to function template instantiation 'CEGUI::SubscriberSlot::SubscriberSlot<bool(__thiscall BufferedInputHandler::* )(void)>(const T &)' being compiled
1>        with
1>        [
1>            T=bool (__thiscall BufferedInputHandler::* )(void)
1>        ]
1>Build log was saved at "file://c:\Documents and Settings\Simon Bakkevig\Mine dokumenter\Skole\Hovedoppgave 08-09\herbert_game\herbert_game\obj\Debug\BuildLog.htm"
1>herbert_game - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


And if I try this:

Code: Select all

newGame->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&BufferedInputHandler::newGame, this));


I get this:

Code: Select all

1>------ Build started: Project: herbert_game, Configuration: Debug Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
1>herbert_game.cpp
1>c:\documents and settings\simon bakkevig\mine dokumenter\skole\hovedoppgave 08-09\herbert_game\herbert_game\include\framelistener.h(71) : error C2661: 'CEGUI::SubscriberSlot::SubscriberSlot' : no overloaded function takes 2 arguments
1>Build log was saved at "file://c:\Documents and Settings\Simon Bakkevig\Mine dokumenter\Skole\Hovedoppgave 08-09\herbert_game\herbert_game\obj\Debug\BuildLog.htm"
1>herbert_game - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


If anyone could help me out I would be very grateful.

I'm using VS9.

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

Re: Compiling error on PushButton::EventClicked callback

Postby CrazyEddie » Sat Apr 25, 2009 20:54

Hi, and welcome :)

Your handler function must have a 'const CEGUI::EventArgs&' argument, so the signature should be something like:

Code: Select all

bool BufferedInputHandler::newGame(const CEGUI::EventArgs& args);


HTH

CE.

Hedgehog
Just popping in
Just popping in
Posts: 13
Joined: Sat Apr 18, 2009 13:22

Re: Compiling error on PushButton::EventClicked callback

Postby Hedgehog » Sat Apr 25, 2009 21:37

That was it, thanks a lot :D


Return to “Help”

Who is online

Users browsing this forum: No registered users and 16 guests