[mcclim-devel] prompt-for-items-from-list with list-pane

John Morrison john.nmi.morrison at gmail.com
Wed Oct 31 23:20:31 UTC 2012


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 at 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 at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20121031/73330617/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prompt2.lisp
Type: application/octet-stream
Size: 1217 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20121031/73330617/attachment.obj>


More information about the mcclim-devel mailing list