Re: NSValueTransformer problem with NSTextField update
Re: NSValueTransformer problem with NSTextField update
- Subject: Re: NSValueTransformer problem with NSTextField update
- From: Paul Bruneau <email@hidden>
- Date: Thu, 1 Oct 2009 13:45:23 -0400
On Oct 1, 2009, at 1:23 PM, I. Savant wrote:
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.
Thanks again IS and thanks Quincey (and Graham). I will look at
validation, which I have never used before. I do shudder a little bit
to have to copy/paste a validate method for each of the 20 or so
properties that I'm dealing with (especially when it works so nice in
tables just for free!!)
I also like Quincey's explanation of why it works in a table, makes
sense.
In my initial tests of a validate<key> method, it is receiving the
value AFTER my transformer has transformed it to a number of 32nds
(I'm not getting the original fraction string).
I think I'm in trouble, because if I don't modify the value coming
into the validator, then it doesn't fire the field update. If I modify
it, though, then yes, the field gets updated:
// this method will cause the field to get updated upon pressing Return
-(BOOL)validateTopClearance:(id *)ioValue
error:(NSError **)outError
{
if (*ioValue == nil) {
return YES;
}
//add 1 to my number just to force it to update as a test
NSNumber * newValue = [NSNumber numberWithInteger:[*ioValue
integerValue] + 1];
*ioValue = newValue;
return YES;
}
So apparently, the validator is noticing if I alter the value, and it
does nothing (to my eyes) if the value is untouched. I am back at the
beginning :)
_______________________________________________
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