Re: Binding NSTextField to a number through NSArrayController
Re: Binding NSTextField to a number through NSArrayController
- Subject: Re: Binding NSTextField to a number through NSArrayController
- From: Conrad Shultz <email@hidden>
- Date: Sat, 30 Jun 2012 12:29:31 -0700
IIRC that's just telling you that IB can't validate your keypath. (There's a place in one of the inspectors to define what the "known" keypaths are.)
NSValueTransformer is generally not applicable for numbers, but it's usually good practice to attach an NSNumberFormatter to the field to handle both display formatting and input validation (e.g. min/max, etc.)
(Sent from my iPad.)
--
Conrad Shultz
On Jun 30, 2012, at 12:00, Todd Heberlein <email@hidden> wrote:
> I have an NSTextField that I am binding to an NSArrayController's selection (a number value in that selection). In the "Model Key Path" field I get an exclamation mark inside a red stop sign icon.
>
> Even more confusingly, the code still works. I get the right value! But that exclamation mark has be nervous (like it works now, but no guarantee).
>
> What am I doing wrong? Do I need to do something special when binding an NSTextField to an NSNumber or NSInteger? Do I need to venture into the world of NSValueTransformers whenever I bind an NSTextField to anything other than an NSString?
>
>
> Thanks,
>
> Todd
>
> Here is my binding settings for the NSTextField
>
> Bind to: procArrayCtlr (an NSArrayController)
> Controller Key: selection
> Model Key Path: recordCount <-- this gets red exclamation mark
> Value Transformer: (empty right now)
>
> _______________________________________________
>
> 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
_______________________________________________
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