[Gambas-devel] Hooking the event loop

Benoît Minisini gambas at ...1...
Fri May 25 20:45:05 CEST 2012


Le 20/05/2012 22:21, tobi a écrit :
> Hi,
>
> I saw in gambas.h that I'm able to install a hook for the event loop. This simply is a function to
> be called by the native event loop, as I saw in gb.qt4, right? Is there any policy to respect when I
> install such a hook (like saving the former hook and calling it, too to not turn off any essential
> attributes of other components)?
> Of course, I wouldn't fiddle around with that without a reason: I have a module that will wait for a
> key press and from then on continuously raise events until a key release occurs. I need a point
> where it makes sense to install a function that periodically dispatches that event. You see, it is
> handled by logic so I have no fd or something to GB.Watch()...
>
> Regards,
> Tobi
>

Actually it's not a hook. It must be a full implementation of an event loop.

The Gambas interpreter has an internal event loop. GUI tookits usually 
implement their own event loop, that is of course not compatible with 
the Gambas one. So, by specifying the 'LOOP' hook, you tell the 
interpreter not to use its own event loop, but let the toolkit use its 
own one.

I don't give you all the detail. It is more complex than that, because 
the toolkit event loop must be modified so that it can handle Gambas 
timers and file descriptor watches.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list