Re: runModalForWindow allows window switching
Re: runModalForWindow allows window switching
- Subject: Re: runModalForWindow allows window switching
- From: Matt Neuburg <email@hidden>
- Date: Fri, 20 Sep 2002 07:30:01 -0700
On Thu, 19 Sep 2002 16:08:35 -0700, I said:
>
When I call runModalForWindow to bring up an application-modal dialog, it
>
works okay, but while the dialog is up, I'm able to switch between the
>
other windows in my app.
A number of readers were bold enough to deny flatly offline that this was
true, so let's get down to the nitty gritty here. I'm cross-posting because
I haven't receive any online responses.
Make a new Cocoa project, and in IB give it a controller class MyObject and
instantiate it. Give the nib two more windows, and make the first of them
visible at startup. Thus, the situation is now that Window and Window1 will
be visible at startup, and Window2 will not. Give the controller an outlet
called window2 and hook it up to the third window.
Give Window a button connected to an action, and give Window2 a button
connected to an action. Make the files. Back in PB give the actions this
code, respectively:
[NSApp runModalForWindow: window2];
and
[NSApp stopModal];
Build and run. The first two windows appear. One of them has a button.
Press it. This makes the third window appear, and now we are running modal
in it. Now play with the other two windows. You will be able to move them
around and change their order.
(I was wrong, however, about being able to dismiss them; the close button
highlights red, but does not actually work.)
Now - deny *that*. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.