[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
(Our mailserver was down yesterday and since I didn't receive this message from
mcl-info I assume it didn't get through. Resending it now. Sorry if anyone gets
this message twice.)

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 in the *default-menubar* are disabled.  Can anyone
explain this behaviour to me? 

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))