• 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: Subclassed NSTextField can't bind backgroundColor to NSCollectionViewItem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassed NSTextField can't bind backgroundColor to NSCollectionViewItem


  • Subject: Re: Subclassed NSTextField can't bind backgroundColor to NSCollectionViewItem
  • From: David Carlisle <email@hidden>
  • Date: Sat, 1 Dec 2007 12:16:25 -0700

Just override the bind method in the NSTextField subclass. Then when it is called to bind to "value", add a binding to "backgroundColor."

On Dec 1, 2007, at 2:19 AM, David Carlisle wrote:

I'm trying to simulate an NSTableView using an NSCollectionView because [[(NSTableView *)tv animator] reloadData] won't work. I thought it would be more likely I could animate an NSCollectionView. I have at least one NSTextField in my CollectionViewItem NSView where I want to be able to control the background color.

Since the text of the NSTextField is bound in Interface Builder to the NSCollectionViewItem, I thought that to bind to the backgroundColor in my NSTextField subclass, I could put the following method in its initWithCoder method. The "cvi" variable is an IBOutlet connected in IB to the NSCollectionViewItem.

[self bind: @"backgroundColor"
	  toObject:cvi
  withKeyPath:@"representedObject.backgroundColor"
	   options:nil];

The problem is that when NSTextField initWithCoder is called, cvi is nil.

Is there a workable approach? And is there a good reason why backgroundColor shouldn't be bindable in Interface Builder?


_______________________________________________

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


References: 
 >Subclassed NSTextField can't bind backgroundColor to NSCollectionViewItem (From: David Carlisle <email@hidden>)

  • Prev by Date: Re: Binding NSTabViews in NSCollectionViews?
  • Next by Date: NSAnimation in leopard
  • Previous by thread: Subclassed NSTextField can't bind backgroundColor to NSCollectionViewItem
  • Next by thread: Re: Leopard NSTableView Cell and single click editing
  • Index(es):
    • Date
    • Thread