Page 1 of 1

Problem of event passing!

Posted: Fri Oct 28, 2005 11:12
by olvierwpz
The cegui event seems do not fire for one time.
I put two button in the same postion but different layer.
The first button fire the event first .
If set the button hidden or removed in it`s event dealing function,the second button`s event dealing function will be fired.
So when I change from one state to another by button clicked.If there is a button with the same postion in the second state.It will be fired.This is exactly what I met.
Is there any setting function to make the event be fired for only one time.
Thanks!

Re: Problem of event passing!

Posted: Fri Oct 28, 2005 15:55
by martignasse
...So when I change from one state to another by button clicked...

maybe you just make you'r layers visible or not to manage you'r states, if it's the case, try to desactivate them, it should prevent event firing.

hope it help

Re: Problem of event passing!

Posted: Sat Oct 29, 2005 00:17
by olvierwpz
But if the button is the return button of a framewindow or state. Then it`s job is to call the state manager to change state .Hid or remove current state is must to be done.

Re: Problem of event passing!

Posted: Sat Oct 29, 2005 09:20
by martignasse
maybe i misanderstand something,

you have two layers superposed, and they represents to differents stat of you'r app. And you want only one to be visible and active at a time. is it correct ?

Re: Problem of event passing!

Posted: Mon Oct 31, 2005 02:48
by olvierwpz
Sorry for my poor description.
Thank you for your eager reply.

You have got the point of my problem.
you have two layers superposed, and they represents to differents stat of you'r app. And you want only one to be visible and active at a time. is it correct ?


When I click the back button of the first state,It fires the event to change state.But the back button in the same position of the second state get the click event too. Then it`s event fired without exception.

Thanks again!

Re: Problem of event passing!

Posted: Tue Nov 01, 2005 12:58
by martignasse
Sorry for my poor description.
Thank you for your eager reply.
no problems, helping you is helping me...to learn CEGUI :cool:

When I click the back button of the first state,It fires the event to change state.But the back button in the same position of the second state get the click event too. Then it`s event fired without exception.
ok, so :

you have you'r app with these two superposed layer. but only one have te be active at a time, depend on the state, say the first for now. so the second should be hidden and deactivated.

when you click on the first back button, only this one should fire event (cause the second layer is hidden and deactivated.) ok.

and in responding to this event, you have to :
-make the first layer hidden and deactivated.
-make the second layer visible and activated.

and at this point, the system will find this new activated back button of the second layer and fire a second event :(

So, you have to tell the system to not continu the event distribution after you handle fonction.
I believe Event::ScopedConnection is made for that but not sure of the way to use it... or if it's completly implemented now.

can't help more for now...CEGUI expert needed :oops:
i'm afraid that you'll have to found a workaround.

Re: Problem of event passing!

Posted: Thu Dec 08, 2005 03:25
by Viper
olivierwpz,

If you haven't yet found a solution to your problem, then i would try unsubscribing to the event for the button that you do not want to get activated. Then, when you handle the event, unsubscribe the current button and subscribe the other.

Hope this helps.