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

Re: a listener that won't listen



At 10:41 PM 1/27/95, Martin Stanley wrote:
>Hello all,
>
>It's been a while since I frequented this list, so excuse me if this has
>been asked recently.
>
>I am creating an application in 2.0.1 and want to have a back door to lisp
>available for debugging. What I want is to be able to switch between the
>application's menus and my normal list development menus at will. This I
>can do with no problem. But I also, of course, would like a listener
>available in the lisp side of things. I manage to get a listener window,
>but get no prompt in this window: there appears to be no read-eval-print
>loop. The Eval menu-item also gives no response. I suspect that the problem
>may lie with event-dispatch or somesuch, but the application seems to be
>able to cope just fine.
>
>Here is a snapshot of how I have things set up.
>
>This is how I save the application. I call this with :debug t.
>
>(defmethod save-as-application ((app FWapplication) &key (debug nil))
>  (map nil 'CloseDocument (FWDocuments app))
>  (unless debug
>    (window-hide *top-listener*))
>  (save-application (choose-new-file-dialog
>                     :prompt "Save new application.."
>                     :button-string "Save")
>                   :init-file nil
>                   :toplevel-function #'application-startup
>                   :creator (creatortype app)
>                   :excise-compiler (not debug)))
>
>Then I call this function from a menu-item in the application.
>
>(defun mcl ()
>       (FWRevertMenus)
>       (if *top-listener*
>         (window-show *top-listener*)
>         (setq *top-listener* (make-instance 'listener))))
>
>Anybody have any comments on this or any advice on how to do what I want
>properly. I would appreciate getting email directly as well as posting
>answers to the list.
>Thanks in advance,

The Listener won't "Listen" unless MCL's toplevel loop is running
to do so. Basically, you need to be inside of ccl:toplevel-loop.
Hence, your MCL function needs to end with:

(defun mcl ()
  ...
  (%set-toplevel 'toplevel-loop)
  (toplevel))

Likewise, the function that switches back to your application's
menubar needs to %set-toplvel to your application's toplevel-loop
and execute (toplevel) to install it.