Re: NSValueTransformer problem with NSTextField update

2009-11-10 Thread Paul Bruneau
If anyone is interested in seeing this issue with NSValueTransformer and how it performs in a table vs in a text field, I had filed a bug (7268704) on it and was asked to provide an example. So I thought I'd share my example: http://ethicalpaul.com/share/transformer_sample_code.zip It's

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Paul Bruneau
Hi again- I got no responses to my query, which probably means I asked something poorly, but I needed to write another NSValueTransformer for my project (to convert dollars into pennies and back) and I saw the same behavior so I thought I'd ask again. To summarize: When I use my

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Graham Cox
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

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Paul Bruneau
On Oct 1, 2009, at 9:47 AM, Graham Cox wrote: 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

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread I. Savant
Paul: On Oct 1, 2009, at 8:49 AM, 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

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Paul Bruneau
On Oct 1, 2009, at 10:45 AM, I. Savant wrote: Have you tried turning on the text field's value binding's continuously updates value option? Maybe even the validates immediately option? I imagine the wrong combination of these (including off) could have something to do with it. Thanks for

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread I. Savant
On Oct 1, 2009, at 10:58 AM, Paul Bruneau wrote: Thanks for the suggestion, IS. I had in fact tried those and I tried them again just now (in all combinations), no change. Hmmm ... This (figure 2):

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Quincey Morris
On Oct 1, 2009, at 05:49, Paul Bruneau wrote: I got no responses to my query, which probably means I asked something poorly, but I needed to write another NSValueTransformer for my project (to convert dollars into pennies and back) and I saw the same behavior so I thought I'd ask again.

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Paul Bruneau
On Oct 1, 2009, at 11:10 AM, I. Savant wrote: On Oct 1, 2009, at 10:58 AM, Paul Bruneau wrote: Thanks for the suggestion, IS. I had in fact tried those and I tried them again just now (in all combinations), no change. Hmmm ... This (figure 2):

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread I. Savant
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

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Paul Bruneau
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

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Quincey Morris
On Oct 1, 2009, at 10:45, Paul Bruneau wrote: // this method will cause the field to get updated upon pressing Return -(BOOL)validateTopClearance:(id *)ioValue error:(NSError **)outError { if (*ioValue == nil) { return YES; }

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Paul Bruneau
On Oct 1, 2009, at 2:16 PM, Quincey Morris wrote: What was the number you tried this with? Some NSNumber values are singleton objects, so returning a new NSNumber with the same value might really return the original object. :) Or maybe just equality of value matters. It occurs to me that

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread I. Savant
On Oct 1, 2009, at 3:26 PM, Paul Bruneau wrote: I just thought of something IS said earlier: 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

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Quincey Morris
On Oct 1, 2009, at 12:26, Paul Bruneau wrote: The other way to approach this is to add a second set of properties -- the formatted string values of your numeric properties -- that are dependent on the numeric ones, and bind to the string properties instead. It's a PITA to code it all, but

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Paul Bruneau
On Oct 1, 2009, at 3:34 PM, I. Savant wrote: The problem is, I think, that most developers aren't overloading the input as you are. :-) I knew this would come up! :) But in actuality, this same problem would occur regardless of whether I was overloading the input. Even in the very

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread I. Savant
On Oct 1, 2009, at 4:38 PM, Paul Bruneau wrote: I do have 20ish edit fields to contend with on my main window. I could set up a preference to let the user select his preferred entry method (there are just 2), but I still think I would still have the trouble with the inconsistent updating

Re: NSValueTransformer problem with NSTextField update

2009-10-01 Thread Quincey Morris
On Oct 1, 2009, at 13:38, Paul Bruneau wrote: That scenario does sound very similar to mine. I'd forgotten, in my application I simplified the user interface because of various validation difficulties (maybe including bindings issues, I don't remember), so all I've got left is a sheet

NSValueTransformer problem with NSTextField update

2009-09-17 Thread Paul Bruneau
Greetings- I have written a subclass of NSValueTransformer which converts an NSString from something like 1-1/2 to an NSNumber with a value of 48 for my model to store (converts inches and fractions to number of 32nds). It also does the reverse transformation. This is working perfectly