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 simplest case there would be this annoying difference between the two interface types that would manifest any time the user did not enter the value in exactly the same way the reverse transformer creates it.

You're allowing (if I'm counting correctly) three different modes of input into the same text field with no indication, aside from the formatting of the text, which format the user is inputting.

 How about this (IMO) cleaner UI solution?

1 - Keep your base unit of measurement behind the scenes.
2 - Add a control that sets and shows (NSSegmentedControl, perhaps?) the input format. Place it beside or below the text field. 3 - Use an NSFormatter (one for each input mode, swapped out when the mode is changed) to format the input as required for that mode. 4 - Likewise, use an NSValueTransformer (one for each input mode, swapped on mode change) to convert the currently-selected mode's input to the base unit of measurement.

It might be slightly less-convenient in that you can't type in just anything and have it magically formatted, but it ensures proper input and, if done right, demonstrates to the user the expected input format. It also frees you writing what is likely some very error-prone parsing code.

Compare this to Apple's rocky love affair with natural language date input in NSDateFormatter.

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 behavior between text fields and table views which is the reason for this thread. Plus it works so very very well and my users are all trained from 10 years of using the Classic and then Carbon versions of this app :)

But I thank you sir!

On Oct 1, 2009, at 3:47 PM, Quincey Morris wrote:

Now that you mention it, I've done exactly what you are trying to do, except I was using formatted time codes instead of fractions. I want to say that it was working correctly, but I can't swear to it. I'll have to go back to that app and see if it really does prettify the string representation when the underlying value doesn't change.

I would appreciate that. That scenario does sound very similar to mine. Thanks! _______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to