• 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
Dismissing an alert programatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dismissing an alert programatically


  • Subject: Dismissing an alert programatically
  • From: John Calhoun <email@hidden>
  • Date: Tue, 22 Jan 2008 19:17:38 -0800

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—_______________________________________________

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


  • Follow-Ups:
    • Re: Dismissing an alert programatically
      • From: Chris Suter <email@hidden>
  • Prev by Date: Re: [[NSView animator] setHidden:YES] doesn't fade?
  • Next by Date: Re: Dismissing an alert programatically
  • Previous by thread: Newbie image resource question
  • Next by thread: Re: Dismissing an alert programatically
  • Index(es):
    • Date
    • Thread