CLIM mail archive

[Prev][Next][Index][Thread]

Re: menu-choose




----- Begin Included Message -----

...

The sizing parameters you are supplying are being passed to the table
formatter to control the layout of the menu items.  They are not used
to size the menu window.  Instead, the menu-choose code sizes the
window to fit the output.  There is mechanism in the substrate to
control the width and height of the menu window, but due to an
apparent oversight, there is no way for the user to control it.

So, you can do what you suggested and write your own version of
menu-choose, or you can do something like the (Lucid-specific) kludge
I am including below.  The function size-menu-appropriately is called
by the menu-choose-from-drawer code.  The basic ideas is that you can
intercept that call and fiddle with the :WIDTH and :HEIGHT options.

Sorry that I can't offer something better than this...

================================================================
(in-package :clim-user)

(defvar *default-menu-width* nil)
(defvar *default-menu-height* nil)

;;; Intercept the menu-sizing operation, imposing a default
;;; width and height constraint.
(lcl:defadvice (clim::size-menu-appropriately size-menu) 
    (menu &rest args &key width height)
  (unless width (setq width *default-menu-width*))
  (unless height (setq height *default-menu-height*))
  (lcl:apply-advice-continue menu :width width :height height args))

(defun menu-choose-1 (item-list win &rest keys)
  ;; Show only the first 7 lines
  (let ((*default-menu-height* (* (stream-line-height win) 7)))
    (menu-choose item-list :n-columns 1 
		 :n-rows 7 
		 :associated-window win)))


----- End Included Message -----

Anyone have a similar kludge for Genera 8.1.1 (CLIM 1.1)?

--Robin




0,,

Follow-Ups:

Main Index | Thread Index