• 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: Binding NSTableColumn.textColor to Two Things;
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding NSTableColumn.textColor to Two Things;


  • Subject: Re: Binding NSTableColumn.textColor to Two Things;
  • From: Matt Budd (Madentec) <email@hidden>
  • Date: Fri, 30 Jul 2004 16:47:04 -0600

Awesome! Thanks for the help....I was starting to think that by hiding the difficult stuff from you, bindings also limited you from doing what needed to be done. But I can do what I need to do in code, like you've shown me here.

Thanks again!

- Matt


On Jul 30, 2004, at 4:19 PM, mmalcolm crawford wrote:


On Jul 30, 2004, at 2:44 PM, Matt Budd (Madentec) wrote:

The problem is that a change on the preference panel only ripples through to the column of the table view when I change the value in the table view (and it then tries to reapply the transformer which gives the correct dynamic NSColor). I would like a change to ripple through to the text color immediately upon change in the preference panel.

Either register for preferences change notifications, or (probably better), observe user defaults:


- (void)awakeFromNib
{
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKeyPath:@"values.favoriteColor" // whatever key
options:0
context:favColorContext];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context == favColorContext)
{
[tableview reloadData];
}
// If appropriate: [super observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context];
}


I should probably update the Preferences example to follow this pattern...

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Binding NSTableColumn.textColor to Two Things; (From: Matt Budd (Madentec) <email@hidden>)
 >Re: Binding NSTableColumn.textColor to Two Things; (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Cocoa/Obj-C Restart Computer
  • Next by Date: Re: Cocoa/Obj-C Restart Computer
  • Previous by thread: Re: Binding NSTableColumn.textColor to Two Things;
  • Next by thread: Re: instance variables...
  • Index(es):
    • Date
    • Thread