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

Pop-Up Problems

I'm trying to create a pop-up menu with code like this:

(defmethod install-view-in-window ((menu pop-up) window)
  (let* ((menu-items (menu-items menu)))
    (apply #'remove-menu-items menu menu-items)
    (with-font-focused-view menu
      (let* ((vc (view-container menu))
             (pos (convert-coordinates (view-position menu) vc window))
             (size (view-size menu))
             (dhandle nil)
             (title (dialog-item-text menu))
             (title-width (+ (string-width title) 8)))
        (with-pstrs ((ptitle title))
          (rlet ((rect :rect
                       :topleft pos
                       :bottomright (add-points pos size)))
            (multiple-value-bind (menu-id menu-handle)
                                 (make-menu-resource menu)
              (setq dhandle
                     (wptr window)  ;window
                     rect                       ;boundsrect
                     ptitle                     ;title
                     nil                        ;visible-p
                     0                          ;font style
                     menu-id                    ;resource id
                     title-width                ;width of title area
                     (+ #$popupMenuproc ;#$popupMenuCDEFProc
                        #$popupUseWFont)        ;we want a pop-up menu
                     0))                        ;refcon (unused)
              (setf (dialog-item-handle menu) dhandle)
              (#_RmveResource menu-handle)
              (let* ((colors (part-color-list menu)))
                  (unless colors (return))
                  (set-part-color menu (pop colors) (pop colors))))
              (apply #'add-menu-items menu menu-items)
              (unless (dialog-item-enabled-p menu)
                (#_HiliteControl dhandle 255)))))))))
Under System 7.0 this worked fine.  Under 7.1, the control object still
gets created, but it no longer appears in the window.  If I change the
constants to make the control a button, say, then it shows up again,
but when it's a popup it refuses to be visible.

Has anyone had similar trouble or know of any reason why this might not
work with 7.1?


Mike Lenz
Apple ATG