• 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
Re: NSCollectionView - getting notified of selection change?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCollectionView - getting notified of selection change?


  • Subject: Re: NSCollectionView - getting notified of selection change?
  • From: Roland King <email@hidden>
  • Date: Mon, 13 Oct 2008 18:39:48 +0800

what bothers you about that being KVC-compliant? NSIndexSet is just an immutable object no different from ... NSString. yes it sort of represents a sparse array, but it's just a one-to-one relationship with the NSCollectionView, each NSCollectionView can have a selectionIndexes property and that's one single NSIndexSet. When the selection changes, the entire set changes even if the range it represents changed only by one index.

I thought your addObserver: call looked right and the keyPath: looks right too. Did you try adding NSKeyValueObservingOptionInitial just so you can satisfy yourself you get SOMETHING for that property? What's mutating it? I assume the GUI is and I'd assume that it mutates it in a KVC-compliant manner but ... perhaps it doesn't.

On Oct 13, 2008, at 6:02 PM, Graham Cox wrote:


On 13 Oct 2008, at 7:23 pm, Nathan Kinsinger wrote:

On Oct 13, 2008, at 1:26 AM, Graham Cox wrote:
,
The title says it all really - is there a way to get notified about selection changes in a NSCollectionView? The docs appear to indicate that this is not possible, but that seems to be a very obvious need, so it's surprising.

tia,

Graham

The documentation for NSCollectionView selectionIndexes

	"This property is observable using key-value observing."

http://developer.apple.com/documentation/Cocoa/Reference/NSCollectionView_Class/Introduction/Introduction.html#/ /apple_ref/occ/instm/NSCollectionView/selectionIndexes



Yes, I saw that, but I can't get it to work, since I'm just not seeing how NSIndexSet is KVC compliant, nor how NSCollectionView is KVC compliant for that property. I'm obviously missing some facet of KVO here, since using KVO in more conventional circumstances works OK for me.

I have:

[mPickerView addObserver:self forKeyPath:@"selectionIndexes" options:NSKeyValueObservingOptionNew context:NULL];

but my observer is never notified. The keyPath is obviously wrong, but I can't figure out what it's meant to be. It's not even clear if the "selection" is considered a to-one or a to-many relationship here. But in any case this property doesn't appear to fit any of the criteria listed for KVC compliance:

http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Compliant.html#/ /apple_ref/doc/uid/20002172

So... huh? I'm sure I'm being dense but I'm not getting something here.


Graham _______________________________________________

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: NSCollectionView - getting notified of selection change?
      • From: Graham Cox <email@hidden>
References: 
 >NSCollectionView - getting notified of selection change? (From: Graham Cox <email@hidden>)
 >Re: NSCollectionView - getting notified of selection change? (From: Nathan Kinsinger <email@hidden>)
 >Re: NSCollectionView - getting notified of selection change? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSCollectionView - getting notified of selection change?
  • Next by Date: right-click on a title-bar of borderless-window
  • Previous by thread: Re: NSCollectionView - getting notified of selection change?
  • Next by thread: Re: NSCollectionView - getting notified of selection change?
  • Index(es):
    • Date
    • Thread