Re: NSValueTransformer problem with NSTextField update
Re: NSValueTransformer problem with NSTextField update
- Subject: Re: NSValueTransformer problem with NSTextField update
- From: "I. Savant" <email@hidden>
- Date: Thu, 1 Oct 2009 13:23:14 -0400
On Oct 1, 2009, at 1:02 PM, Paul Bruneau wrote:
Well if you look at Figure 2, step #23, it says "Updated value now
stored in model object. Key-value observing notifications are sent
to observers of this model property."
So due to the binding, the text field would get updated by this
mechanism, wouldn't it?
I wouldn't expect that behavior normally. The transformer is doing
only that - transforming the value that's being propagated to the
model layer via Bindings.
Thing is, aside from transformed values, the value that makes it to
the model layer is usually a direct reflection of what was just set in
the view. :-) In 99% of cases, this would seem a waste of CPU cycles
to go back and make sure the view reflects the value it itself just
claimed to have set.
I may be wrong and welcome education from anybody who knows better.
And promise or no, it is occurring in the table view...it's
mysterious.
As Quincey mentioned, it's probably because the data cell for that
column (the prototype that's reused to draw that column's value for
each row) is being updated per row, which involves reading that value
and setting it as the cell's object value. I agree: this seems the
most likely reason for this behavior.
I am pretty ignorant of the differences, but in converting from a
fraction to a number of 32nds, I picked NSValueTransformer. It does
work great :) I'm just seeing this inconsistency between cells in a
table, and text fields in a window.
Ah, you're right. You're actually changing the value, not merely
shifting its decimal. I hadn't noticed that (maybe it was in your
original post, but I didn't go back to read that and if it was in your
repost, I completely failed to see it :-}).
I believe you made the right choice there. I admit I hadn't thought
of Quincey's suggestion - you should definitely try that and see if it
helps.
--
I.S.
_______________________________________________
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