• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Solved: Not receiving notifications on NSArrayController selection changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solved: Not receiving notifications on NSArrayController selection changes


  • Subject: Solved: Not receiving notifications on NSArrayController selection changes
  • From: Ken Tozier <email@hidden>
  • Date: Mon, 6 Jul 2009 01:18:20 -0400

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 (email@hidden)

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:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Solved: Not receiving notifications on NSArrayController selection changes
      • From: Mac First <email@hidden>
References: 
 >Not receiving notifications on NSArrayController selection changes (From: Ken Tozier <email@hidden>)

  • Prev by Date: Not receiving notifications on NSArrayController selection changes
  • Next by Date: NSTableview - tableView:heightOfRow: not behaving
  • Previous by thread: Not receiving notifications on NSArrayController selection changes
  • Next by thread: Re: Solved: Not receiving notifications on NSArrayController selection changes
  • Index(es):
    • Date
    • Thread