Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!labrea!polya!kaufman
From: kaufman@polya.STANFORD.EDU (Marc T. Kaufman)
Newsgroups: comp.sys.mac.programmer
Subject: Re: MultiFinder switch bug with custom WDEFs
Keywords: MultiFinder doesn't allow switching when it thinks it sees a dBoxProc
Message-ID: <2781@polya.STANFORD.EDU>
Date: 7 May 88 15:50:10 GMT
References: <242@uvabick.UUCP> <8700@apple.Apple.Com> <2887@midas.TEK.COM> <9332@apple.Apple.Com> <2770@polya.STANFORD.EDU> <9364@apple.Apple.Com>
Reply-To: kaufman@polya.stanford.edu (Marc T. Kaufman)
Organization: Stanford University
Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!labrea!polya!kaufman
From: kaufman@polya.STANFORD.EDU (Marc T. Kaufman)
Newsgroups: comp.sys.mac.programmer
Subject: Re: MultiFinder switch bug with custom WDEFs
Keywords: MultiFinder doesn't allow switching when it thinks it sees a dBoxProc
Message-ID: <2781@polya.STANFORD.EDU>
Date: 7 May 88 15:50:10 GMT
References: <242@uvabick.UUCP> <8700@apple.Apple.Com> <2887@midas.TEK.COM> <9332@apple.Apple.Com> <2770@polya.STANFORD.EDU> <9364@apple.Apple.Com>
Reply-To: kaufman@polya.stanford.edu (Marc T. Kaufman)
Lines: 33

In article <9364@apple.Apple.Com> darin@apple.UUCP (Darin Adler) writes:
>In article <2770@polya.STANFORD.EDU> kaufman@polya.stanford.edu (Marc T. Kaufman) writes:
.> One of the main reasons for using modal dialogs where modeless dialogs
.> would do, is the availability of the Dialog Manager for handling most of
.> the buttons, switches, and events.  If a dialog is modeless, you cannot
.> use IsDialogEvent, NewDialog, GetNewDialog, or the ModalDialog event filter.

>Absolutely untrue! IsDialogEvent, NewDialog, and GetNewDialog can all be used
>with modeless dialogs. Note that for a modeless dialog, you create the dialog
>and then return to the main event loop. Some of the events you receive from
>GetNextEvent or WaitNextEvent need to be passed to the dialog manager. After
>gettin an event, you call IsDialogEvent. If that returns TRUE, then you call
>DialogSelect for the event.

OK, I agree that GetNewDialog and NewDialog can be used for modeless dialogs,
but the important thing is that the DLOG resource has no way of specifying
a window type other than modal-dialog.  I HAVE used these routines to start
a modeless dialog, by setting the initial window to invisible, then changing
the window type in the dialog before showing the window for the first time.
However, and here is the catch, if you make the window a non-dialog type
(so that Multifinder will switch -- remember that multifinder doesn't care
how you USE the window, only its type), then IsDialogEvent will always
return FALSE -- because IsDialogEvent goes through the Window list looking
for MODAL DIALOG windows.

DialogSelect, and the other dialog item handlers that take a DialogPtr
as a parameter, work OK because they know where to find the dialog window
(you gave them the pointer).

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

Marc Kaufman (kaufman@polya.stanford.edu)