how to manage user events in event que

BlitzMax Forums/MaxGUI Module/how to manage user events in event que

ima747(Posted 2010) [#1]
If I emit a number of events with the same type and source they all show up in the que, is there a simple way to cull the extras so only one will be in the que? I'm under the impression that events like mousemove are handled like this, but maybe that's OS controlled and not a function of the event que itself?


SebHoll(Posted 2010) [#2]
is there a simple way to cull the extras so only one will be in the que?

Yep! If you post the event to the event queue directly (instead of indirectly through EmitEvent), then you can specify True as the optional update parameter of PostEvent, and the event already in the queue will be updated instead.

This will of course bypass event hooks.


ima747(Posted 2010) [#3]
aha! PostEvent() you coy devil...

hmmm, bypassing hooks shouldn't be too big a deal as long as I still emit events for things that I have hooked...

Thanks seb!

Followup question, is WaitEvent tied to the hook?


SebHoll(Posted 2010) [#4]
Followup question, is WaitEvent tied to the hook?

Sorry, I'm not sure that I understand the question. WaitEvent() is basically a WaitSystem() wrapped inside a While Not PeekEvent(), so not really.

BRL.EventQueue is nothing special. It's just a linked-list of events, with a BlitzMax hook installed that calls PostEvent() on any events that are 'emitted', producing a list of events.

Does this make things any clearer?


ima747(Posted 2010) [#5]
much, thanks!


Rozek(Posted 2010) [#6]
Good morning!

As far as I understand, event hooks are invoked at the time an event is posted (in order to avoid the latency which may occur before the gets dequeued and handled) - thus, they are not related to WaitEvent at all.