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

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

At  3:38 PM 7/28/93 +0000, Karsten Poeck wrote:
>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

The patch that Karsten Poeck mentioned is indeed a reasonable way to get around
this problem. His patch can be improved by binding *menubar-frozen* true during
the menu enabling and window closing.

(defun modal-dialog (...)

        (let ((*menubar-frozen* t))
          (update-menus-for-modal :enable ms)
          (if close-on-exit
            (window-close dialog)
            (progn (window-hide dialog)
                   (set-window-layer dialog 9999))))))))

I have prepared a patch for inclusion in patch 3 for MCL 2.0 that includes
this change. If you want it before then, ask for "menu-enable-patch".

Bill St. Clair