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

Hierarchical Menu Bug ??



#|
Posted this a while ago and got no response. I'll give it another shot.

Has anyone else had problems when the try to make *a lot* of menu-items? I
wonder if I'm running into some pre-set limit that I don't know about
because I can't get enough

Run the following code in a MCL image with plenty of RAM:

|#

(in-package :cl-user)

(defparameter *num-menus* 7)
(defparameter *submenus-per-level* 6)
(defparameter *max-depth* 2)

(defvar *w*)

(defun build-submenus (root-num depth)
    (if (>= depth *max-depth*)
       (list (make-instance 'menu-item
                     :menu-item-title (format nil "root #~s, depth ~s"
root-num depth)
                     :menu-item-action #'(lambda () (message-dialog (format
nil "root #~s,  depth ~s" root-num depth)))))
         (let ((menus))
            (dotimes (j *submenus-per-level* menus)
                (format t "making submenus for root ~s,  menu ~s, depth
~s~%" root-num j depth)
                (push (make-instance 'menu 
                                 :menu-title (format nil "menu #~s" j)
                                 :menu-items (build-submenus root-num (1+
depth)))
                            menus)
                ))))

(setf *w* (make-instance 'window 
                       :view-size #@(150 250)
                       :window-title "menu test"))

(gc)
(room)

(dotimes (i *num-menus*)
    (add-subviews (find-window "menu test")
    (make-instance 'pop-up-menu 
          :menu-title (format nil "menu #~s" i)
          :menu-items (build-submenus i 0)
          :view-position (make-point 20 (* 25 i))
          :item-display i
          )))

(room)

#|

You'll see that the last menu has about no items in it and the second to
last one gives up about halfway through.

Any ideas?

--Jeff

|#