[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with menu enable/disable and temp. dialogs
- To: info-mcl@digitool.com
- Subject: Re: Help with menu enable/disable and temp. dialogs
- From: poeck@informatik.uni-wuerzburg.de (Karsten Poeck)
- Date: 3 Feb 1995 08:05:29 GMT
- Organization: University of Wuerzburg
- References: <1995Feb2.195748.14157@ptolemy-ethernet.arc.nasa.gov>
- Sender: owner-info-mcl@digitool.com
In article <1995Feb2.195748.14157@ptolemy-ethernet.arc.nasa.gov>,
chucko@kronos.arc.nasa.gov (Chuck Fry ) wrote:
> This works when switching between long-lived windows, but it has a
> problem when one of the menu operations calls GET-STRING-FROM-USER.
> The temporary dialog box pops up over the Modeling window, and the
> menus are correctly (?) deactivated. But when the dialog box goes
> away, the menus are NOT reactivated. The only way to get them back is
> to select another window, then reselect the Modeling window.
Try the following hack, If it works ask bug-mcl for something like
menu-enable or modal-dialog patch
Karsten
(in-package :ccl)
(eval-when (eval compile)
(require 'level-2)
(require 'defrecord)
(require 'sysequ)
(require 'toolequ)
(require 'backquote))
(let ((*warn-if-redefine-kernel* nil))
(defmethod modal-dialog ((dialog window) &optional (close-on-exit t)
eventhook
&aux ret)
(#_FlushEvents #xfff7 0)
(let* ((*modal-dialog-on-top* *modal-dialog-on-top*)
(*eventhook*
#'(lambda (&aux (event *current-event*) (what (rref event
eventrecord.what)))
(unless (eq (window-layer dialog) 0)
(set-window-layer dialog 0))
(unless (and eventhook
(if (listp eventhook)
(dolist (f eventhook)
(when (funcall f) (return t)))
(funcall eventhook)))
(if (eq $mButDwnEvt what)
(%stack-block ((wp 4))
(let* ((code (#_FindWindow (rref event
eventrecord.where) wp)))
(cond
((eq code $inMenubar)
(unwind-protect
(progn (#_SetCursor *ARROW-CURSOR*)
(setq *interrupt-level* 0)
(update-menus-for-modal)
(menu-selected (#_MenuSelect (rref
event eventrecord.where))))
(#_HiliteMenu 0) t))
((%ptr-eql (wptr dialog) (%get-ptr wp))
nil)
(t (#_Sysbeep 5) t))))
(if nil ; (or (eq what $keyDwnEvt) (eq what $AutoKeyEvt))
(when (menukey-modifiers-p (rref event
eventrecord.modifiers))
(ed-beep)
t))))))
(*processing-events* nil)
(*interrupt-level* 0))
(declare (special *eventhook* *processing-events*))
(declare (dynamic-extent *eventhook*))
(let (ms)
(unwind-protect
(progn
(setq ret (multiple-value-list
(restart-case
(catch '%modal-dialog
(set-window-layer dialog 0)
(setq *modal-dialog-on-top* dialog)
(window-show dialog)
(setq ms (update-menus-for-modal :disable))
(loop
(event-dispatch t)))
(abort () :cancel)
(abort-break () :cancel))))
(if (eq (car ret) :cancel)
(throw-cancel :cancel)
(apply #'values ret)))
(setq *modal-dialog-on-top* nil
*processing-events* t) ; delay events until the
window-close is over
(let ((*menubar-frozen* nil))
(update-menus-for-modal :enable ms)
(if close-on-exit
(window-close dialog)
(progn (window-hide dialog)
(set-window-layer dialog 9999))))))))
)
Karsten A. Poeck, Lehrstuhl fuer Informatik VI, Universitaet Wuerzburg
Allesgrundweg 12, 97218 Gerbrunn, Germany
E-mail: poeck@informatik.uni-wuerzburg.de
Tel ++ 49 931 70561 18, Fax ++ 49 931 70561 20
http://wi6a76.informatik.uni-wuerzburg.de/HTMLs/ls6-info/Assis/poeck/poeck.html