Next Prev Up Top Contents Index

12.4.6 Using menu-choose-from-drawer

This example displays in the window *page-stream* the choices One through Ten in boldface type. When the user selects one, the string is returned along with the gesture that selected it.

 *page-stream* 'string
 #'(lambda (stream type)
     (clim:with-text-face (:bold stream)   
                          (dotimes (count 10)       
                            (clim:present (string-capitalize
                                           (format nil "~R" (1+ count)))
                                          type :stream stream)       
                            (terpri stream)))))

This example shows how you can use menu-choose-from-drawer with with-menu to create a temporary menu:

(defun choose-compass-direction (parent-window)
        (stream ptype symbol x y)
         (:stream stream :object symbol :type ptype)
         (clim:draw-string* stream
                            (symbol-name symbol) x y
                            :align-x :center
                            :align-y :center
                            '(:sans-serif :roman :large))))
        (stream ptype)
        (clim:draw-line* stream 0 25 0 -25 :line-thickness 2)
        (clim:draw-line* stream 25 0 -25 0 :line-thickness 2)
        (loop for point in '((n 0 -30) (s 0 30) (e 30 0)(w -30 0))
              do (apply #'draw-compass-point
                        stream ptype point))))
    (clim:with-menu (menu parent-window)
                    (clim:menu-choose-from-drawer menu 'clim:menu-item

Common Lisp Interface Manager 2.0 User Guide - 14 Dec 2001

Next Prev Up Top Contents Index