Re: code behind NSRunAlertPanel
Re: code behind NSRunAlertPanel
- Subject: Re: code behind NSRunAlertPanel
- From: "Jeremy W. Sherman" <email@hidden>
- Date: Tue, 21 Apr 2009 23:45:01 -0400
>
> Incidentally I was mistakenly under the impression that -runModalForWindow:
> was deprecated.
>
You were likely thinking of -[NSApplication
runModalForWindow:relativeToWindow:], which has been superseded by
-beginSheet:modalForWindow:…. -runModalForWindow: is used to display an
application-modal window, not a sheet. -[NSAlert runModal] might be a better
option in this case.
I am curious why NSRunAlertPanel is able to run on top of a modal dialog.
> Can someone please point me to the code sample or document?
>
To run a sheet on an app-modal window, you'll need to work with the way
events are being handled by the application during the modal session. The
Cocoa Event-Handling Guide might be of some assistance. You should also pull
up the NSAlert class reference and check out the listed companion guides, as
well as possibly guides listed as companions to those guides. You'll find
sample code in those guides, as well.
—Jeremy
On Tue, Apr 21, 2009 at 9:53 PM, Graham Cox <email@hidden> wrote:
>
> On 22/04/2009, at 9:22 AM, John Yeh wrote:
>
> Can someone please point me to the code sample or document?
>>
>
>
> [NSApplication
> beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo];
>
> Does it for me...
>
>
> Incidentally I was mistakenly under the impression that -runModalForWindow:
> was deprecated. That's not the case, but nevertheless I've never used it,
> I've always used the above method and it works fine even to display sheets
> on other dialogs and floating panels.
>
>
> --Graham
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden