Binding NSTableColumn.textColor to Two Things;
Binding NSTableColumn.textColor to Two Things;
- Subject: Binding NSTableColumn.textColor to Two Things;
- From: Matt Budd (Madentec) <email@hidden>
- Date: Fri, 30 Jul 2004 15:44:08 -0600
Hello,
I am experiementing with Cocoa bindings, and am unsure how to achieve
what it is I'm looking for. I'll explain what I have now.
I have done the classic NSTableView bound to a NSArrayController that
uses my own custom data class. My code is based loosely on mmalc's
"ToDo application" on his sample page
(
http://homepage.mac.com/mmalc/CocoaExamples/ToDos.zip), in that I use
a custom NSValueTransformer to format the text color of column 1 based
on the value in column 2 (which in my case is an integer).
Now everything works good, except I want my custom NSValueTransformer
to not use hardcoded colors (i.e. it maps 0-20 as 'red', 21-40 as
'orange', etc). Instead I want to drive this through the
NSUserDefaultsController and the Shared User Defaults. I've built a
preference panel that correctly binds to this, and that part is working
great. I've also modified my NSValueTransformer code to read its values
form the Shared User Defaults, and this works good as well.
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.
Basically I want to still say that the text color of column 1 is bound
to the "MyTransformer(arrangedObjects.myIntValue) [NSArrayController]",
but in addition I want it to also be bound the different colors I
stored in Shared User Defaults...not really bound to it, but I want
that column to redraw itself if any of those colors changes...
Am I missing some base concept here? Or is this a limitation of
bindings?
- Matt
_______________________________________________
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.