Never mind. I figured it out.

On Jul 5, 2009, at 11:58 PM, Ken Tozier wrote:

Hi

I have an NSArrayController bound to an NSArray and am not getting notifications either through my "setXXX method or through explicit "addObserver" links.

The property in my class is defined like so:

@interface PMXMainPaletteToolbar : NSView
{
        IBOutlet        NSPopUpButton                   *site;
        
        NSDictionary            *siteRecords;
        
        NSString                        *currentSite;
                                                
        NSArrayController       *siteController;
}


The array controller is initialized like so

- (void) initTools
{
siteRecords = [[PMInterfaceController invocation] invokeWithSelector: @"get_sites_simple" arguments: @""]; siteController = [[NSArrayController alloc] initWithContent: siteRecords];
        
// bind popup content to array controller array (This works. Popup is populated correctly) [site bind: @"content" toObject: siteController withKeyPath: @"arrangedObjects.name" options: nil];
        
// even though class has a currentSite property, a currentSite method and a setCurrentSite method // the setCurrentSite method is never called when bound to the array controller [self bind: @"currentSite" toObject: siteController withKeyPath: @"selection.name" options: nil];

// When above binding failed, I tried to explicitly define a listener to the "selection" and "selectionIndexes" property of siteController
        // but neither observer gets called in response to menu selections.
        [siteController addObserver: self
                        forKeyPath: @"selectionIndexes"
options: NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew
                        context: NULL];

// When both of those failed, I tried to listen for the selectedValue of the popup
        [site addObserver: self
                        forKeyPath: @"selectedValue"
options: NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew
                        context: NULL];

        // that failed as well. My "observeValueForKeyPath" is never called.
}

So the question is, how the heck does one get real time notifications to user selections in a popup menu?

Thanks for any help




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/kentozier%40comcast.net

This email sent to kentoz...@comcast.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to