[mcclim-devel] event handling outside the top-level loop

Andy Hefner ahefner at gmail.com
Tue Mar 10 03:41:42 UTC 2009


On Mon, Mar 9, 2009 at 6:42 AM, Sascha Wilde <wilde at sha-bang.de> wrote:

> I'm playing around with an mandelbrot explorer with an simple clim
> interface.  This means the application spends a lot of time in an local
> loop[0].  During this time the interface is "dead" as no events are
> handled.  So I would like to trigger the event handling from time to
> time in my own code -- is there an easy way to do so?

You can manually poll the event queue and dispatch any events that are
present. This might look something like this*:

 (let ((queue (frame-event-queue frame)))
    (loop for event = (event-queue-read-no-hang queue)
          while event do (handle-event (event-sheet event) event)))

This is not exactly equivalent to a CLIM app idle at its top level
(notably, you're outside of the command loop, so interactor panes
won't work at all), but should suffice for getting working repaint
events, gadget callbacks, scroll bars, etc.

*Disclaimer: I haven't tried this code.




More information about the mcclim-devel mailing list