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

Pop-up-menu bug removing last menu item



#|
Evaluate the following code, select "2" from the pop-up, then click
"Remove". I get this error:


> Error: Undefined method calling: MENU-ITEM-TITLE
>         with args: (NIL)
> While executing: #<STANDARD-METHOD NO-APPLICABLE-METHOD (T)>
> Type Command-. to abort.
See the RestartsI menu item for further choices.
1 > 

System:

(LISP-IMPLEMENTATION-VERSION) -> "Version 2.0.1p2"
(MACHINE-VERSION) -> "Macintosh IIci with 68030, 68882, Apple extended keyboard"
|#


(require "POP-UP-MENU")

(make-instance 'window
  :view-size #@(200 50)
  :view-subviews
  (list (make-instance 'pop-up-menu
          :dialog-item-text "Remove"
          :view-nick-name 'pop-up
          :menu-items (list (make-instance 'menu-item :menu-item-title "1")
                            (make-instance 'menu-item :menu-item-title "2")))
        (make-instance 'button-dialog-item
          :dialog-item-text "Delete"
          :dialog-item-action
          #'(lambda (button)
              (let ((pop-up (view-named 'pop-up (view-container button))))
                (remove-menu-items pop-up (selected-item pop-up))
                ;; BUG?: remove-menu-items doesn't update pop-up-menu items:
                (invalidate-view pop-up t))))))