CLIM mail archive


Interrupting a process with a pointer press

   Date: Tue, 8 Dec 92 13:37:16 -0500
   From: (Sigalit Yom-Tov)

   >   I am trying to write an application that prints a line to the window at
   >   regular intervals, unless the mouse button is pressed, in which case it
   >   goes off and does something else. Is there an easy way to do this via
   >   CLIM, or do I have to dive into the world of multitasking?

   >There is no supported way, but the following internal function will
   >do the trick.  Note that you have to be running a CLIM input loop
   >somewhere (e.g. at least calling READ-CHAR if not the command top
   >level) in order for the button state transitions to be tracked.

   >(clim::pointer-button-state (stream-primary-pointer win))

   Can you explain more? Will this work for an asynchronous interrupt?

In CLIM 1.1, event processing is only active when some process is in a
CLIM input wait (e.g. a call to ACCEPT or READ-CHAR or an application
top-level input wait).  As events come in, they are processed and the
state information in the pointer object for the appropriate window is
updated with the new coordinates.  Therefore, code that is running in
a loop with no input processing will never get the updated values.

If you want to get event processing done inside a computation loop,
you can insert a call to (stream-input-wait win :timeout 0) in the
body.  This will process any pending events but will return
immediately if none are available.



Main Index | Thread Index