My CLIM Kung Fu is not so great, but it seems a slot on the application frame might be more to your liking?  I would be interested if there is some better, more canonical approach...

-jm

On Sun, Sep 23, 2012 at 4:36 AM, Kilian Sprotte <kilian.sprotte@gmail.com> wrote:
Hi,

I made a simple implementation of prompt-for-items-from-list. Any
comments? In particular, I am wondering if :items *items* using a
special variable is the only way to initialize the list-pane.

Regards,
  Kilian

(defvar *items*)

(define-application-frame items-from-list ()
  ((exit-command :accessor exit-command))
  (:menu-bar t)
  (:panes
   (list (make-pane 'list-pane
                    :mode :nonexclusive
                    :items *items*)))
  (:layouts
   (default
    (scrolling (:scroll-bar :vertical)
      list))))

(macrolet ((frob (command)
             `(define-items-from-list-command (,command :name t :menu t) ()
                (setf (exit-command *application-frame*) ',command)
                (frame-exit *application-frame*))))
  (frob com-ok)
  (frob com-cancel))

(defun prompt-for-items-from-list (items)
  (flet ((get-list-pane (frame)
           (find-pane-named frame 'list)))
    (let* ((*items* items)
           (frame (make-application-frame 'items-from-list)))
      (run-frame-top-level frame)
      (ecase (exit-command frame)
        (com-ok
         (values (gadget-value (get-list-pane frame))
                 t))
        (com-cancel
         (values nil
                 nil))))))


_______________________________________________
mcclim-devel mailing list
mcclim-devel@common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel