Re: NSPopUpButton Notifications
Re: NSPopUpButton Notifications
- Subject: Re: NSPopUpButton Notifications
- From: Sam Stigler <email@hidden>
- Date: Tue, 22 May 2007 23:54:26 +1000
I've never dealt with notifications before, but just off the top of
my head, have you tried moving your code above the call to super in
the mouseUp method? For example: (disclaimer: written in Mail, etc.)
-(void)mouseUp:(NSEvent *)theEvent {
[[NSNotification defaultNotificationCenter]
postNotificationName:@"SCPopUpButton" object:self];
[super mouseUp:theEvent];
}
I'm thinking that maybe somehow the call to super is short-circuiting
your code.
-Sam
http://www.stigler.org/sam/wordpress
On May 22, 2007, at 11:30 PM, MH wrote:
i have a custom NSPopUpButton class as I need a notification on mouse
up event, but it doesn't seem to be working correctly.
Here's the class
@interface SCPopUpButton : NSPopUpButton {
}
- (void)mouseUp:(NSEvent *)theEvent;
@end
@implementation SCPopUpButton
- (id)init
{
self = [super init];
if (self != nil) {
// initialization code
}
return self;
}
- (void)mouseUp:(NSEvent *)theEvent {
// [super mouseUp:theEvent];
[[NSNotificationCenter defaultCenter]
postNotificationName:@"SCPopUpButtonUp" object:self];
}
@end
and here the MyDocument snippet from the init method to register
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(lightSelectionDidChange:)
name:@"SCPopUpButtonUp"
object:lightSelector];
Which doesn't seem to be working.
I'm aware of the NSPopUpNotification thats posted when a menu is first
clicked, but I need the mouseUp ideally. Can anyone see the problem?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mac.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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