Page 1 of 1

[BUG?]! subscribeEvent can ignore repeat event regist

Posted: Thu Jan 07, 2010 06:36
by koria
dear CE, how are you .
i found subscribeEvent a eventname and a function over 1 times. when the event happend to call fireEvent_impl. this will call the function over 1 times . In fact, we only hope the function call once when the event happens.

some code like this: i do it use lua.
local wmgr = CEGUI.WindowManagerBase_getSingleton()
local itemgrid = wmgr:getWindow("itempanel/iteminfo/grids")
itemgrid :regEvent("MouseClick","item_move_pickup") ---fist time regist event ,right

itemgrid :regEvent("MouseClick","item_move_pickup") ---in fact ,this regist event should be ignore

itemgrid :regEvent("MouseClick","item_move_pickup") ---in fact ,this regist event should be ignore

itemgrid :regEvent("MouseClick","item_move_pickup") ---in fact ,this regist event should be ignore

when MouseClick event happends, function named "item_move_pickup" in a lua file , will be called 4 times in one MouseClick eventargs.
On these occasions, "item_move_pickup" function must be call 1 times, not 4 times , or it will be a bug.


i am sorry for my poor english . i am chinese guys .
can you take a notice at this question ?
thanks a lot !!!

Re: [BUG?]! subscribeEvent can ignore repeat event regist

Posted: Thu Jan 07, 2010 10:06
by CrazyEddie
Hi,

This is not a bug as such. It's just the way things are. Within CEGUI there is no way of testing that function 'x' has been subscribed to event 'y', so the app needs to deal with that, since the app has that information. This is also the reason for the use of a connection object, rather than an 'unsubscribe' function - such a thing is not easily achieved using the current events mechanism.

HTH

CE.

Re: [BUG?]! subscribeEvent can ignore repeat event regist

Posted: Thu Jan 07, 2010 10:47
by koria
so we need to manager these infos what eventname and functionname in our app ?
yes .

now i got your mind :)
thanks a lot!