PDA

View Full Version : NSPopUpButton Notification Question


AndrewSage
2004.08.06, 07:18 AM
I have a window with several controls.

I want to know when any of these controls have been changed.

Using NSNotificationCenter I've managed to detect when a NSTextField has been changed.

Can anyone tell me how to detect when the NSPopUpButton controls have been changed?

I tried observing for the NSPopUpButtonWillPopUpNotification, but that is no good as that only tells you when the mouse button has been pressed down and not released with the new change.

I've spent my lunch time trying to find out about this on the net, but have had no luck and now must return to work :(

Roosterhouse
2004.08.06, 03:50 PM
Could you subclass NSPopUpButton and post a notification in - mouseUp?


- (void)mouseUp:(NSEvent *)theEvent {
[super mouseUp:theEvent];
[[NSNotificationCenter defaultCenter]
postNotificationName:@"PopUpButtonChanged" object:self];
}

Or would this not work?

Chris

Sohta
2004.08.06, 03:57 PM
by "Have been changed", I assume that their value changed...

I'm wondering, why can't you use an IBAction for this?

AndrewSage
2004.08.06, 05:41 PM
I tried linking it up to an action but nothing happened.

I would hope it would be simple to add in a notification like when a text field is changed.