Re: Execute code when exiting textfield
Re: Execute code when exiting textfield
- Subject: Re: Execute code when exiting textfield
- From: Brian Todd <email@hidden>
- Date: Wed, 7 Feb 2007 13:59:03 -0800
There is one thing I wasn't clear about. The preference contains the
modifier 'fatDV' which is passed as the parameter to the Value
Transformer. The Value Transformer gets the value 'fat' from my array
controller and performs a calculation, then outputs the result. This
only works on startup. If I don't pass 'fatDV' to the Value
Transformer the binding updates automatically.
-Brian
On Feb 7, 2007, at 11:42 AM, Brian Todd wrote:
You're right. I guess I got sidetracked from the real problem. I
initialized the Value Transformer in my app controller and setup
the bindings in Interface Builder. This code means that the
preference is read on application startup but is not changed via
the bindings later. I thought I needed to tell the program to
refresh after it didn't update automatically. Maybe I am setting
the Value Transformer in the wrong place.
+ (void)initialize
{
FixedtoPercentDV *fixedToPDV;
// create an autoreleased instance of our value transformer
fixedToPDV = [[[FixedtoPercentDV alloc] init]
autorelease];
[fixedToPDV setFactor:[[NSUserDefaults standardUserDefaults]
integerForKey:@"fatDV"]];
// register it with the name that we refer to it with
[NSValueTransformer setValueTransformer:fixedToPDV
forName:@"FixedtoPercentDV"];
}
On Feb 7, 2007, at 1:08 AM, Scott Anguish wrote:
value transformers are typically used with bindings. That would
mean you wouldn't need to do anything at all.
Have a look at the temperature converter project that ships with
Xcode in /Developer/Examples/AppKit
On Feb 7, 2007, at 2:13 AM, Brian Todd wrote:
I have been trying to take a preference from the User Defaults
and pass it to a Value Transformer. I have successfully taken the
value from User Defaults on startup and passed it to the Value
Transformer but I can't figure out how to change the Value
Transformer when the preferences are edited. I created a
preferences panel controller and I think I should be executing my
code when the text field is unselected but I can't figure out
which method will send the change to the Value Transformer.
Brian Todd
email@hidden
www.dancelesson.us
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
Brian Todd
email@hidden
www.dancelesson.us
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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