[comp.sys.mac.programmer] IsDialogEvent

steele@unc.cs.unc.edu (Oliver Steele) (05/08/88)

kaufman@polya.stanford.edu (Marc T. Kaufman) points out that IsDialogEvent
only works on dialogKind windows, which prevent MF from switching even if
they're being used as modeless, and asks:

>Now... how do you do the IsDialogEvent function without writing a whole
>event loop -- which is why you use ModalDialog in the first place.?

I've found it easier to rewrite the event loop, since sometimes you
need the extra flexibility and you only have to do it once (if you've
got a general application skeleton with a procedural interface), but
I also had success with surrounding IsDialogEvent with assignments of
dialogKind and userKind, respectively, to the windowKind of my frontmost
window.  (Other windows can keep dialogKind all the time, or you can
update them too).  If you lithp, you're lambda-binding to windowKind
with dynamic scope during evaluation of IsDialogEvent.

Of course, this is enormously kludgy, but then so is the Dialog Manager
(by today's standards, not 1984's).  Methinks it ought to be replaced by
a ROM-supported cross between MacApp and Commando-style dialogs, so I
can separate some more syntactic and UI information from my source code.

 ---------------------------------------------------------------------------
 Oliver Steele					  ...!decnet!mcnc!unc!steele
 UNC-CH CS and LING depts				   steele@cs.unc.edu

 "We made it structured, and now it doesn't work." -- Brice Tebbs