Dismissing an alert programatically
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