[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple events
- To: firstname.lastname@example.org (Jiqian Pan)
- Subject: Re: Multiple events
- From: email@example.com (Bill St. Clair)
- Date: Mon, 14 Sep 1992 12:22:26 -0500
- Cc: info-mcl
>Hi, MCL Experts:
>Here are some funny things about other events when a WHILE function
>is called inside a method and in Listener. Their code is:
>(defclass my-window (window) ())
>(setf foo (make-instance 'my-window))
>(defmethod view-key-event-handler ((foo my-window) char)
> (print char))
>(setf *true* t)
>(defmethod view-click-event-handler ((foo my-window) position)
> (declare (ignore position))
> (while *true*
>When the function WHILE is called in Listener, the method
>view-key-event-handler works, that is, I can see characters
>on Listener. However, when WHILE is called inside the method
>view-click-event-handler, the method does not work. I want
>other events to be able to work when a loop function is called
>inside a method. I am wondering whether I have missed something
>and there are other ways to do the function.
>Thanks for your help.
As I said in mail to INFO-MCL last week, event processing is locked out
while processing an event. In MCL 2.0 this is done by binding the
special variable ccl::*processing-events* to true. In 2.1, this will
be done differently. Hence, I suggest that you use the following macro
if you really must allow events while processing an event. You should
realize that though wrapping the loop inside your event handler with an
(allowing-events (loop ...)) will allow keyboard input to go to the Listener,
it won't evaluate any of those expressions until the event handler exits. MCL
does NOT (yet) have multiple processes.
; Macro to allow event processing from within an event handler.
; Usually, this is not the right thing to do: use EVAL-ENQUEUE instead.
; This code works for MCL 2.0. It will likely break in future versions.
(defmacro allowing-events (&body body)
`(let ((*processing-events* nil)