sheetDidDismiss selector no good from NSBeginAlertSheet
sheetDidDismiss selector no good from NSBeginAlertSheet
- Subject: sheetDidDismiss selector no good from NSBeginAlertSheet
- From: Andrew Taylor <email@hidden>
- Date: Wed, 22 Sep 2004 12:23:09 -0400
Title: sheetDidDismiss selector no good from
NSBeginAlertSheet
Hi,
I am trying to detect when an alert sheet presented by
NSBeginAlertSheet has been dismissed, and then do stuff afterwards.
Using Xcode 1.5 and X 10.3.5 on a 1ghz Powerbook.
So, trying the obvious I provided a selector for the didDismiss
argument.
No joy.
Here is what shows up in the console window after I run the
included code:
2004-09-22 12:14:00.525 test[1472] called sheetgone
2004-09-22 12:14:00.527 test[1472] *** -[MyWindow itsgone:]: selector
not recognized
2004-09-22 12:14:00.529 test[1472] *** -[MyWindow itsgone:]: selector
not recognized
So what should be the prototype for the didDismiss selector if it
is not what the documentation and header file says?
Or is there something else I am doing wrong?
thanks.
#import "MyWindow.h"
@implementation MyWindow
- (void)displayErrorMessage:(NSString *)error
dismiss:(SEL) didDismiss
{
NSBeginAlertSheet(
@"Error",
@"OK",
nil,
nil,
self,
self,
nil,
didDismiss,
self,
error,
nil);
}
- (void)itsgone:(NSWindow *)sheet returnCode:(int)returnCode
contextInfo:(void *)contextInfo
{
NSLog(@"called
itsgone");
}
- (void)displayURLFailedError
{
NSString
*message = [NSString stringWithFormat:@"this is a message"];
// SEL mySelector =
@selector(itsgone:);
// [self
displayErrorMessage:message dismiss:mySelector];
[self displayErrorMessage:message dismiss:@selector(itsgone:)];
}
-(void)sheetgone:(NSNotification*)note
{
NSLog(@"called
sheetgone");
}
-(void)handleFinishedNotification:(NSNotification*)note
{
[self
displayURLFailedError];
}
- (void)awakeFromNib
{
NSNotificationCenter*nc;
nc =
[NSNotificationCenter defaultCenter];
[nc
addObserver:self selector:@selector(handleFinishedNotification:)
name:NSWindowDidBecomeMainNotification object:nil];
[nc
addObserver:self selector:@selector(sheetgone:)
name:NSWindowDidEndSheetNotification object:nil];
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden