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

Re: y-or-n-dialog from window-c

In article <9307280657.AA11351@london>, andre_koehorst@riks.nl ("Andre
Koehorst") wrote:

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

Since we have a similar problem in our application I played a little bit
with your code and have the following explanation:

The problem is that when you call modal-dialog, your window is deactivated
and the standard menubar is installed. One of the first things modal-dialog
does is to disable the menubar except for the edit-menu. When the modal
dialog is closed, your window is selected and your menubar is installed.
Obviously after that, modal dialog tries to enable the menubar and enables
the items of !!your menubar!!. Afterwards your window is closed and the
standard menu-items are installed, which are still disabled

Is you execute

(defun print-it (&rest egal)
  (declare (ignore egal))
  (pprint (menubar))

(trace (ccl::update-menus-for-modal
          :before print-it))

and then your example code you see that this happens.
1'st call
(#<APPLE-MENU ""> #<MENU "File"> #<MENU "Edit"> #<MENU "Eval"> #<MENU
 #<MENU "Windows">)
2'nd call

(#<APPLE-MENU ""> #<MENU "Wy Window">)

The bug/feature is that ccl::update-menus-for-modal enables/disables the
menubar and not is not called with a list menu-items to be disabled and so
gets confused if the menubar changes between the two calls.

When I change the last two instructions of modal dialog to
	       ; Do this before the window is closed or hided !!
        (update-menus-for-modal :enable ms)
        (if close-on-exit
          (window-close dialog)
          (progn (window-hide dialog)
                 (set-window-layer dialog 9999)))

everything works fine!

The change is that now update-menus-for-modal is called after the
modal-dialog is selected and before the window is closed, not after the
window is closed. I could send you the complete patched definition of
modal-dialog, but I would prefer if somebody from the MCL-team confirms the