• 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: Selections and NSCollectionView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selections and NSCollectionView


  • Subject: Re: Selections and NSCollectionView
  • From: "Tom Harrington" <email@hidden>
  • Date: Wed, 2 Jan 2008 12:52:10 -0700

On Dec 30, 2007 6:04 PM, Rod Schmidt <email@hidden> wrote:
> I've read this thread:
>
> http://lists.apple.com/archives/Cocoa-dev/2007/Nov/msg02158.html
>
> but I can't figure out how to do it. I've exposed bindings, called
> bind:..., tried and observer, and my selected property in my view
> doesn't get set. Could somebody please post some sample code.

To give visual feedback of selection, I added an NSBox behind (but not
containing) the other elements in the view that the collection view
item is using.  In IB, I bound the NSBox's "hidden" property to the
collection view item's "selected" key (with a boolean negation value
transformer).  That gives me simple visual feedback of the selected
item-- the NSBox is only visible when the view is selected, and I can
configure the NSBox's appearance as needed.  I didn't have to expose
any bindings because NSBox already exposes the one I needed.

To get notification of selection changes-- the collection view's
"selection indexes" binding is bound to the selectionIndexes key of
the array controller I'm using to manage the content.  In my app
controller class I observe changes on this key in the array
controller.  Then I can ask the array controller for its
currently-selected indexes to get the appropriate model objects.

--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________

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

  • Prev by Date: Re: Core Data Migration Exception
  • Next by Date: Re: Scripting Bridge && filteredArrayUsingPredicate
  • Previous by thread: NSCollectionView coding headstart extra steps
  • Next by thread: Space Bar Event
  • Index(es):
    • Date
    • Thread