• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dismissing an alert programatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dismissing an alert programatically


  • Subject: Re: Dismissing an alert programatically
  • From: Chris Suter <email@hidden>
  • Date: Wed, 23 Jan 2008 14:51:15 +1100


On 23/01/2008, at 2:17 PM, John Calhoun wrote:

I have some code in the Displays pref pane that brings up an alert:

NSBeginAlertSheet(LOCSTRING(@"About to change..."), LOCSTRING(@"OK"), LOCSTRING(@"Cancel"),
NULL, [_view window], self,
@selector(slamDisplayResolution: returnCode: contextInfo:), NULL, NULL,
LOCSTRING(@"Some software may..."));


There is a situation where I need to programatically dismiss the alert (when the display hardware changes — like you detach a secondary display while the alert is up). I tried finding the alert with:

	sheet = [[_view window] attachedSheet];

And I dismiss it then with:

	if (sheet)
		[sheet close];

This appears to work except that the next click in my view is ignored and I hear an NSBeep() sound.

Is there a better way to dismiss this alert? Or is this an AppKit bug?

John Calhoun—

You also need to call one of NSApp's endSheet methods.

- Chris


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >Dismissing an alert programatically (From: John Calhoun <email@hidden>)

  • Prev by Date: Dismissing an alert programatically
  • Next by Date: Re: NSRuleEditor
  • Previous by thread: Dismissing an alert programatically
  • Next by thread: reset alternating row background color
  • Index(es):
    • Date
    • Thread