Page 1 of 1

[SOLVED] Problem subscribing to events

Posted: Sun Jul 13, 2008 15:26
by sipickles
Hello,

I have two questions. Firstly, a weird error. I cannot see anything wrong with this code:

Code: Select all

void CGUI::Bind( const std::string& name )
{
      CEGUI::Window* w = m_windowManager->getWindow( name );
      w->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CGUI::SendGUIEvent, this));
}



but it gives me this error:

Code: Select all

error C2661: 'CEGUI::SubscriberSlot::SubscriberSlot' : no overloaded function takes 2 arguments



Secondly, assuming I can get this working, how can I send arguments with the event?

Maybe an ID of the triggering window?

Thanks

Simon

EDIT -- I've tried it with the BIND_CEGUI_EVENT macro too, same problem.

EDIT -- I thought I had found the prob when I noticed my callback function didn't have CEGUI::EventArgs as its arguments. No change in the compile problem, although I guess that answers my second question a little


-------

SOLVED

I forgot I hadn't matched the function signature exactly. My callback (SendGUIEvent) was void(EventArgs*) not bool(EventArgs*)

oops!

:hammer: