Re: Binding NSTableColumn.textColor to Two Things;
Re: Binding NSTableColumn.textColor to Two Things;
- Subject: Re: Binding NSTableColumn.textColor to Two Things;
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 30 Jul 2004 15:19:25 -0700
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.