[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Not hiding modal dialogs
- Subject: Not hiding modal dialogs
- From: gersh@aplpy.jhuapl.edu (John R. Gersh)
- Date: Wed, 12 May 93 21:08:50 GMT
In article <93May11.153540edt.144002@explorer.dgp.toronto.edu> Mark A. Tapia
writes:
>
>I want to use the same window for ordinary operations and
>occasionally as a modal-dialog. When the window is treated as
>a modal-dialog and close-on-return is nil, I want the window
>to be the frontmost window after the modal-dialog.
>
>Here is an attempt based on Guillame Cartier's hide-window-mixin.
>
>Problem: While the window is frontmost at the end of the modal-dialog,
>it disappears for a short period of time. How do I prevent it
>from temporarily disappearing?
>
The window isn't disappearing, it's just being sent to the rear for a
bit. (When you tried your sample there must have been another window
to obscure it.)
The problem is that the modal-dialog method for windows includes the
following code fragment to close the window when returning from the
modal-dialog (from the CD-ROM source):
(if close-on-exit
(window-close dialog)
(progn (window-hide dialog)
(set-window-layer dialog 9999)))
So in your code:
>
>(defmethod modal-dialog ((window my-window) &optional close-on-return
>event-hook)
> (let ((*force-hide* close-on-return))
> (catch-cancel
> (call-next-method window close-on-return event-hook)
> (unless *force-hide*
> (window-select window)))))
>
the call-next-method includes this step of first sending the window all
the way to the rear before selecting it.
One way around this might be to add a slot to your window class:
(defclass my-window (window)
((modal-p :initform nil :accessor modal-p))
(:default-initargs :window-title "Modal demo"))
Then have modal-dialog set that slot:
(defmethod modal-dialog ((window my-window) &optional close-on-return
event-hook)
(setf (modal-p window) t)
(let ((*force-hide* close-on-return))
(catch-cancel
(call-next-method window close-on-return event-hook)
(unless *force-hide*
(window-select window))))
(setf (modal-p window) nil))
And then specialize set-window-layer:
(defmethod set-window-layer ((w my-window) new-layer
&optional include-invisibles)
(unless (modal-p w)
(call-next-method)))
These changes seem to make your sometimes-modal window work the way
you want.
---------------------------------------------------------------------
John Gersh John_Gersh@jhuapl.edu
The Johns Hopkins University Applied Physics Laboratory
Johns Hopkins Rd., Laurel, MD 20723 (301) 953-5503