Re: NSValueTransformer problem with NSTextField update
Re: NSValueTransformer problem with NSTextField update
- Subject: Re: NSValueTransformer problem with NSTextField update
- From: Graham Cox <email@hidden>
- Date: Thu, 1 Oct 2009 23:47:37 +1000
On 01/10/2009, at 10:49 PM, Paul Bruneau wrote:
But when I use the transformer on a regular NSTextField, I don't get
that benefit. It properly transforms the value and the correct value
gets stored in my model, but the reverse transformation doesn't fire
like it does when used in the table view.
I don't have a definitive answer for you, but I've observed similar
behaviour in some of my text fields. As long as you're typing, what
you type is what the field will display. On enter/return, the value is
sent to the data model, through the transformer if necessary. The
question is what happens then?
For fields that are updated via KVO, I find that the reverse
transformation will be applied and the field gets updated. That makes
sense because there is a notification coming back from the data model
that updates the UI. For fields where I just have a one-way type of
situation (plain target-action, say), the field doesn't get updated -
again for obvious reasons.
So I'd be looking at the data model --> view data path for the
solution to this, not the other way around.
Not sure if this is any help, but you don't state how your UI and data
model connect - target/action, KVO or bindings.
--Graham
_______________________________________________
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