Hi,

Am Fr,15.08.2008 um 00:21 schrieb Markus Spoettl:

Hi List,

how can I make a view value which is bound to a property manually re-read (or update) the value it displays?

The simplified setup is this: I have an object, that stores its values (say a temperature) in Celcius. I also have an application preference that lets the user switch between temperatures in Celcius and Fahrenheit for viewing and editing. The view's value binding uses a value transformer that converts the value based on the current application setting.

When the user changes the preference, the view should update its value so it uses the right units. There is no change to the underlying data, so there's no change notification that would force the binding to refresh the view.

So how can I manually make the view update? It seems so simple but I can't figure out how to do this.
Do you know that view and the binding to be updated?

Try this, it simply simulates a model change

NSView* view = … // I assume, that you know that
NSDictionary* binding = [view infoForBinding:/*Probably @"value" … */]; // I assume, that you know that

id object= [binding objectForKey:NSObservedObjectKey];
NSString* keyPath= [binding objectForKey:NSObservedKeyPathKey];
[object willChangeValueForKeyPath:keyPath];
[object didChangeValueForKeyPath:keyPath];

But probably I misunderstood you.

Cheers,
Amin



Regards
Markus
--
__________________________________________
Markus Spoettl

_______________________________________________

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/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]

Amin Negm-Awad
[EMAIL PROTECTED]




_______________________________________________

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