CLIM mail archive
[Prev][Next][Index][Thread]
Re: How to manually poll for events
Date: Thu, 25 Jun 1992 11:29-0400
From: Scott McKay <SWM@stony-brook.scrc.symbolics.com>
Date: Wed, 24 Jun 1992 18:12 EDT
From: Greg Siegle <siegle@aristotle.ils.nwu.edu>
Hi there,
I'd like to be able to click on a presentation which calls a
function which contains a potentially infinite loop, and still be able
to click on other presentations on the screen and have them respond
while that function is looping. It seems that as soon as I click on
one presentation, the other presentations on the screen aren't
clickable until the function called by my first click is finished
executing. Do I need to make my own run-frame-top-level function (I'm
using the default right now)?
If need by, I can make the potentially infinite loop manually check
for click events, but I'm not sure how to do that either...
The presentation type system in CLIM is essentially a synchronous model
of I/O. This is intentional.
You can use READ-GESTURE with :PEEK-P T to "look ahead" for pending
events, and use the documented functions in the presentation type system
to handle mouse click events.
Don't forget to pass :timeout 0 to read-gesture so that it doesn't
hang. The other utility you need to use in order to get sensitivity
while you're peeking ahead is WITH-INPUT-CONTEXT. So the basic
structure of your peek-ahead function is [sorry if I have any syntax
wrong, I don't have a CLIM in front of me]:
(defun frame-peek-ahead (program-frame &key (stream *standard-input*))
(when (with-input-context ('command)
(read-gesture :stream stream :peek-p t :timeout 0))
(execute-frame-command program-frame (read-frame-command program-frame))))
Main Index |
Thread Index