All Manuals > Common Lisp Interface Manager 2.0 User's Guide > Chapter 9 Defining Application Frames > 9.7 Examples of CLIM Application Frames


9.7.2 Constructing a Function as Part of Running an Application

You can supply an alternate top level (which initializes some things and then calls the regular top level) to construct a function as part of running the application. Note that when you use this technique, you can close the function over other pieces of the Lisp state that might not exist until application runtime.

 different-prompts ()
 ((prompt-state ...) ...) 
 (:top-level (different-prompts-top-level)) ...)


(defmethod different-prompts-top-level
  ((frame different-prompts) &rest options)
  (flet ((prompt (stream frame)
                 (with-slots (prompt-state) frame 
                              #'clim:default-frame-top-level frame
                              :prompt #'prompt options)))

Common Lisp Interface Manager 2.0 User's Guide - 20 Sep 2011