[comp.sys.mac.programmer] MF won't swap after calling ModalDialog?

dan@hpnmdla.HP.COM (Dan Pleasant) (07/11/90)

I've asked this question of MacDTS, but just at the moment I have a
deadline approaching and I can't wait a week for an answer.

I have a program that brings up a dialog (*not* a dBoxProc window) and calls
ModalDialog to detect the user clicking one of several buttons.  After
the user's selection the window stays on the screen and the program
goes into a "normal" event loop for a while -- it calls WaitNextEvent,
not ModalDialog.  This is supposed to allow the user to select an
action and then swap the program into the background while the program
does its thing.  But Multifinder refuses to swap!

If you patch out the call to ModalDialog, then Multifinder allows the
swap.  This is good for debugging but not so great for the user.

Does anybody know how I can get Multifinder to allow the user to swap
out the program under this condition?  It sounds like the system is
setting a flag somewhere in ModalDialog and forgetting to un-set it.

Here's hoping somebody has noticed this problem before...

Dan Pleasant

keith@Apple.COM (Keith Rollin) (07/13/90)

In article <450011@hpnmdla.HP.COM> dan@hpnmdla.HP.COM (Dan Pleasant) writes:
>I've asked this question of MacDTS, but just at the moment I have a
>deadline approaching and I can't wait a week for an answer.
>
>I have a program that brings up a dialog (*not* a dBoxProc window) and calls
>ModalDialog to detect the user clicking one of several buttons.  After
>the user's selection the window stays on the screen and the program
>goes into a "normal" event loop for a while -- it calls WaitNextEvent,
>not ModalDialog.  This is supposed to allow the user to select an
>action and then swap the program into the background while the program
>does its thing.  But Multifinder refuses to swap!
>
>If you patch out the call to ModalDialog, then Multifinder allows the
>swap.  This is good for debugging but not so great for the user.
>
>Does anybody know how I can get Multifinder to allow the user to swap
>out the program under this condition?  It sounds like the system is
>setting a flag somewhere in ModalDialog and forgetting to un-set it.
>
>Here's hoping somebody has noticed this problem before...


Hey, we're getting better. We got your question on the 10th, and its getting
answered today. I'd've answered it yesterday, but I had a queue of 15 other
questions to answer first...

The problem seems to be a bug with ModalDialog. When you put up a dialog and
call ModalDialog on it, ModalDialog sets a bit in the window's spareFlag
field. With this bit set in the front window, MultiFinder won't switch to
another application. This is a change from earlier versions of MultiFinder,
where it refused to switch based on the kind and variant of the frontmost
window.

Anyway, ModalDialog sets this bit, but it doesn't clear it. I suppose it
didn't expect you to keep around your window after the user told you to
put it away. Try clearing the bit, and see what happens.

-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc.  ---  Developer Technical Support
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions