On Aug 14, 2008, at 8:10 PM, Markus Spoettl wrote:

On Aug 14, 2008, at 5:07 PM, Ron Lue-Sang wrote:
Here's how I look at your situation.

Your view is bound to some property. It's job is to listen for KVO notifications and redraw when it gets the KVO notification. That's it. One input. When there's a change on that one input, then redraw.

What you have is 2 inputs and only one notification. ValueTransformers are meant to be less stateful than you're intending them to be.

You might be tempted to try adding a notification for your celsius/ fahrenheit choice and call [self setNeedsDisplay]; But that's not what I'd do.

I'd have whatever-controller-my-view-is-bound-to have a property that represents the temperature based on the current settings. It would receive the userDefault notification and update its temp. property.

We've never explicitly defined a "do this to make the view refresh its bound values". The main reason is that that's a messy way to mentally model the way bindings work.

Sorry if that doesn't answer the question you asked, but hopefully this is information you can use to get work done.


Thanks for the response, though it's unfortunate for me I guess.

The problem is that I actually have a lot arrays of lots of objects each with a number of different properties that can be displayed in more than one way (all dependent on one preference settings). Putting these through proxies/proxy arrays so that I can use bindings and KVO to make process automatic sounds like a terribly painful way to go - plus it defeats the purpose of bindings a little (glue code wise).

I have suspected that my use of ValueTransformers is not quite what they were intended for but they actually do this job very well.

Anyway, thanks for the advice.

Regards
Markus
-

Hmm yea, that's a bummer.
If I were building the views you're using, I'd publish another binding in/from those views. Like "dataType" or "ridiculouslyLongGermanStyleNameDescribingWhatTheBindingIsFor".

And then your views would really have two inputs and you'd actually draw differently in your drawRect method because you can change your view state in response to the KVO notification your view gets from the 2 things it's bound to - and the handling of the KVO notification can safely do [self setNeedsDisplay] and know that that's gonna work.

But I bet you're just trying to use plain old textFields. Yea?

--------------------------
RONZILLA



_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to