Page 1 of 1

Events are being fired WAY too much

Posted: Wed Jul 13, 2005 22:40
by Rayoom
I have two pages/screens, and two buttons to flip back and forth between them (the two layouts).

I am using

Code: Select all

subscribeEvent(
      CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(
      &CLoginState::handleSkipLogin,this));


Each time I go from the first page to the second, this event is being fired way too many times.

It goes some like this:
# of clicks vs. # of times handleSkipLogin() is called
1 | 1
4 | 20
5 | 50
6 | 130
7 | 330+

At this point it takes a few seconds until the second screen pops up. I've got no idea whats going on :shock: .

Re: Events are being fired WAY too much

Posted: Wed Jul 13, 2005 23:05
by lindquist
Sounds like you're calling subscribeEvent (like you posted) from somewhere within your event handler.
You can register the same callback twice and it will be called twice.

Otherwise you would have to be doing some pretty crazy ;) stuff with your mouse button event injections...

HTH

Re: Events are being fired WAY too much

Posted: Thu Jul 14, 2005 01:19
by Rayoom
Thanks, that's pretty much what I was doing.

Each layout has it's own state and each state has an enter and exit function, I was doing all my Subscribing in the Enter() function, whoops :).

Thank you for the help.