Re: Making a bound view re-read its value
Re: Making a bound view re-read its value
- Subject: Re: Making a bound view re-read its value
- From: Negm-Awad Amin <email@hidden>
- Date: Fri, 15 Aug 2008 15:40:46 +0200
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 (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
Amin Negm-Awad
email@hidden
_______________________________________________
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