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

y-or-n-dialog from window-c

REGARDING                y-or-n-dialog from window-close-event-handler
Some time ago I did sent the following message but i didn't get any replies.
I'm writing an application that needs swapping the menubar and dialogs like the
ones in the example, and would really like to understand why the menubar is
(mostly) disabled. Even if I'm doing something completely stupid, please fill
me in.

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

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

(defparameter *MYWINDOW-MENUBAR*
    "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-MENUBAR*)

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