Notification problem
Notification problem
- Subject: Notification problem
- From: "Al Kirkus" <email@hidden>
- Date: Tue, 30 Apr 2002 21:12:11 -0500
Hi all.
I have scoured the documentation and I think I am doing everything correctly but to no avail.
Here is the situation:
I have a controller object : AppController:NSObject. I want this object to be told anytime a window owned by the application is made key because AppController will keep an instance variable and send menu choices to the correct subclass of NSWindowController (as derived from the current key window object).
I implemented this in AppController.m:
-(void)init{
//some init stuff here and super init etc.
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(setKeyWindowFromNotification:)
name:@"WindowDidBecomeKeyNotification"
object:nil];
return self;
}
-(void)setKeyWindowFromNotification:(NSNotification *)aNotification{
NSLog(@"processing a notification");
[self setCurrentKeyWindow:[aNotification object]];
}
I never ever get to the setKeyWindowFromNotification method. -- no log entries and no errors. When I implemented a similar setup but using delegate methods and setting myself as the delegate to the other windows everything worked. I don't think I should have to set AppController as the delegate for every window I am interested in being key, should I?
Shouldn't something like this just work whenever the applications key window changes/gets set or am I missing something? Don't all NSWindows post WindowDidBecomeKeyNotification to the default NotificationCenter?
Also might be important: the other windows are all in different NIBs which are being loaded as needed.
Confused.
Al Kirkus
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.