• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Controller initialization issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Controller initialization issue


  • Subject: Re: Controller initialization issue
  • From: Scott Anguish <email@hidden>
  • Date: Wed, 7 Jan 2004 02:36:11 -0500

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.

  • Follow-Ups:
    • Re: Controller initialization issue
      • From: Joannou Ng <email@hidden>
References: 
 >Controller initialization issue (From: James Hillhouse <email@hidden>)

  • Prev by Date: Controller initialization issue
  • Next by Date: Re: Two-sided printing
  • Previous by thread: Controller initialization issue
  • Next by thread: Re: Controller initialization issue
  • Index(es):
    • Date
    • Thread