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))))))