Re: responding to NSStepper clicks
Re: responding to NSStepper clicks
- Subject: Re: responding to NSStepper clicks
- From: Koen van der Drift <email@hidden>
- Date: Sun, 18 Dec 2011 12:08:26 -0500
On Dec 18, 2011, at 7:41 AM, Mike Abdullah wrote:
> 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.
Thanks, I'll look at adding a formatter.
Just to be sure I'm doing this correctly in my code I extract the number from my textfield and stepper as follows:
NSUInteger index = [ indexTextField integerValue];
and/or
NSUInteger index = [indexStepper integerValue];
BTW that exclamation mark went away when I select a Value Transformer from the field below it. Is that also required besides a formatter?
- Koen._______________________________________________
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