Re: Controller initialization issue
Re: Controller initialization issue
- Subject: Re: Controller initialization issue
- From: Joannou Ng <email@hidden>
- Date: Wed, 7 Jan 2004 04:51:53 -0500
Hi,
For your textfields' value binding, try setting up a placeholder for
null.
Cheers, Joannou.
I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone. - Bjarne Stroustrup
On Jan 7, 2004, at 2:36 AM, Scott Anguish wrote:
you'd need to set those 0 values in the -init. those are instance
variables, not class variables. +initialize is a class method
if you keep the position as an NSNumber, you could check for nil, and
if it's nil, then don't do the calc (or if it's 0 return nil from the
calculated methods and then set a placeholder.
On Jan 7, 2004, at 2:13 AM, James Hillhouse wrote:
Hey folks,
I have a one model application using an NSObjectController that has
four keys,
position
integratedPosition
integratedVelocity
integratedAcceleration
where position is entered and
integratedPosition
integratedVelocity
integratedAcceleration
are calculated. All keys output to text fields with no formatting. In
my model class, nicely named Integrator, I have the following
initializer
@implementation Integrator
+(void)initialize
{
[ Integrator setKeys:
[ NSArray arrayWithObjects:@"position", nil ]
triggerChangeNotificationsForDependentKey:@"integratedPosition" ];
[ Integrator setKeys:
[ NSArray arrayWithObjects:@"position", nil ]
triggerChangeNotificationsForDependentKey:@"integratedVelocity" ];
[ Integrator setKeys:
[ NSArray arrayWithObjects:@"position", nil ]
triggerChangeNotificationsForDependentKey:@"integratedAcceleration"
];
}
Here's my issue. When the application first starts, the following
values appear
position 1.00
integratedPosition 1
integratedVelocity 1
integratedAcceleration inf
I would love a way to force all the initial values that appear on the
UI at start-up to be 0.00 or something like that. I've played around
with the Bindings pane in IB to no avail. And I've tried a couple of
things involving
@implementation Integrator
+(void)initialize
{
[ self setValue:@"1.00" forKey:@"integratedAcceleration" ];
[ Integrator setKeys:
[ NSArray arrayWithObjects:@"position", nil ]
triggerChangeNotificationsForDependentKey:@"integratedPosition" ];
[ Integrator setKeys:
[ NSArray arrayWithObjects:@"position", nil ]
triggerChangeNotificationsForDependentKey:@"integratedVelocity" ];
[ Integrator setKeys:
[ NSArray arrayWithObjects:@"position", nil ]
triggerChangeNotificationsForDependentKey:@"integratedAcceleration"
];
}
But keep getting back the following error at runtime
Integrator[770] [<Integrator 0x5fd054> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key
integratedAcceleration.
What am I doing wrong? I can't seem to find anything in the
documentation that deals with forcing a textview to have a specific
output until my dependent key position has been entered.
Thanks,
Jim Hillhouse
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.