[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ex



>Date: 09 Sep 92 11:23:00 GMT
>From: Ranson <ranson@LANNION.cnet.fr>
>To: info-mcl@cambridge.apple.com, usher@vax.ox.ac.uk
>Subject: Re:  ex
>Cc: ranson@lannion.cnet.fr
>
>Try (eval-enqueue '(action-press)) instead of a direct call.
>     Daniel.

This should work. I'd like to expound a little bit on why calling
read-line from a DIALOG-ITEM-ACTION function doesn't work.

DIALOG-ITEM-ACTION is called by VIEW-CLICK-EVENT-HANDLER at event processing
time. At this time the variable CCL::*PROCESSING-EVENTS* is bound to true,
telling EVENT-DISPATCH not to call #_WaitNextEvent for fear of reenetering
code that doesn't expect to be reentered. Since key presses are reported
by #_WaitNextEvent, your READ-LINE call has no hope of completing.

You could make your code work as follows, though doing it with EVAL-ENQUEUE
is considered better citizenship:

(defun window ()
  (setq window (MAKE-INSTANCE 'DIALOG
                                :WINDOW-TYPE :DOCUMENT-WITH-ZOOM 
                                :window-title "window"
                                :VIEW-SUBVIEWS
                                (LIST (make-dialog-item 'button-dialog-item
                                                        #@(14 5)
                                                       #@(60 15)
                                                        "Action"
                                                         #'(lambda ( frame)
                                                            frame
                                                            (action-press)))))))

(defun action-press ()
  (window-select (find-window "Listener"))
  (pprint "Started")
  (let ((ccl::*processing-events* nil))     ; *** added code ***
    (read-line))
  (pprint "Finished"))