From kilian.sprotte at gmail.com Sun Sep 23 08:36:00 2012 From: kilian.sprotte at gmail.com (Kilian Sprotte) Date: Sun, 23 Sep 2012 10:36:00 +0200 Subject: [mcclim-devel] prompt-for-items-from-list with list-pane Message-ID: <877grl3zm7.fsf@gmail.com> 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))))))