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

y-or-n-dialog en menus

REGARDING                y-or-n-dialog en menus
In the following code when clicking in the window-close-box of a window of the
class wywindow a yes-or-no-dialog is popped up. After pushing the yes-button or
the no-button some menus are disabled.  Can anyone explain this behaviour to

Thanks in advance
Andre Koehorst
Research Institute for Knowledge Systems
Maastricht, the Netherlands
email: andre@riks.nl (why aren't all adresses that simple?)

;;; file menu-test.lisp
(defclass mywindow (window)

(defparameter *MYWINDOW-MENU*
    "Wy Window"
            :MENU-ITEM-TITLE "New")
            :MENU-ITEM-TITLE "-"
            :DISABLED  T)
            :MENU-ITEM-TITLE "Open")
            :MENU-ITEM-TITLE "Close")
            :MENU-ITEM-TITLE "-"
            :DISABLED T)
            :MENU-ITEM-TITLE "Save")
            :MENU-ITEM-TITLE "Save As...")
            :MENU-ITEM-TITLE "Revert")

(defmethod view-activate-event-handler ((window mywindow))
  (set-menubar *mywindow-menu*)

(defmethod view-deactivate-event-handler ((window mywindow))
  (set-menubar *default-menubar*)

(defmethod close-mywin ((window mywindow))
  (let ((save-changes (y-or-n-dialog "Save changes?")))
    (when save-changes (format t "~%Saving"))))
(defmethod window-close-event-handler ((window mywindow))
  (close-mywin window)

(make-instance 'mywindow)
(mapcar #'menu-enable (menubar))