On 17 Dec 2011, at 11:29, Koen van der Drift wrote:

> 
> On Dec 16, 2011, at 11:48 PM, Quincey Morris wrote:
> 
>> There are various solutions you might choose, depending on how you expect to 
>> handle validation errors for your text field. You can add a number formatter 
>> to the field, or you can change the property to type long long (though you 
>> then need to check for negative numbers yourself), or you can use KVC 
>> validation to substitute a NSNumber object for the NSString object.
> 
> 
> Changing the value from NSInteger to NSNumber in my model did the trick, I 
> don't get the crash anymore, and everything updates accordingly. I don't have 
> to use a formatter either, although I probably need to add anyway to prevent 
> the user from typing anything else but numbers.

You *have* to use a number formatter. What you've probably got a present is the 
text field sending NSString objects down into the model. You're not seeing an 
immediate problem because NSNumber is an object just like NSString, and so can 
be stored, but will completely fail as soon as something tries to work with it.
> 
> The only that does't work yet is that I need to hit enter or tab to have my 
> model respond to a change in the NSTextField. As suggested earlier, I set the 
> binding "Continuously Update Value", but that doesn't work.

That option definitely works since we are using it!
> 
> I also see a small exclamation mark (white on a red circle), in the Model Key 
> Path bindings field, where I bind to my model. Xcode autocompletes the 
> correct property, so I'm not sure what to do with this, since everything 
> works. I don't see that exclamation mark in the NSStepper bindings field.

Put a formatter in and see what happens.

_______________________________________________

Cocoa-dev mailing list ([email protected])

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