Re: Binding NSTextField to an Unsigned int
Re: Binding NSTextField to an Unsigned int
- Subject: Re: Binding NSTextField to an Unsigned int
- From: Mike Abdullah <email@hidden>
- Date: Sun, 4 Feb 2007 00:36:55 +0000
Can you post your whole value transformer class? - that might help :)
Mike.
On 4 Feb 2007, at 00:14, Matthew Leon Grinshpun wrote:
Okay, I just realised that my previous e-mail didn't really hit on
the real problem. This is what I've done:
- (id)reverseTransformedValue:(id)value
{
NSLog(@"entered %u", (unsigned)[value intValue]));
return ([NSNumber numberWithUnsignedInt:((unsigned)[value
intValue] - 1)]);
}
This basically makes the program go nuts. The line "entered
x" (with x being the number I've entered) gets spewed into the log
a gazillion times, and then I get spat back into the debugger. For
some reason the function gets called over and over again as soon as
I enter a value.
I'm totally confused as to why this is happening.
-Matthew
On 3-Feb-07, at 2:45 PM, Mike Abdullah wrote:
Either really. Personally I find NSValueTrasnformer to be
slightly easier to use, but it's up to you.
Mike.
On 3 Feb 2007, at 19:30, Matthew Leon Grinshpun wrote:
Thanks for the info... Does this mean that I subclass NSFormatter
and do that?
On 3-Feb-07, at 1:30 PM, Mike Abdullah wrote:
You have to use -[NSNumber numberWithUnsignedInt:] KVO should
handle making this an actual unsigned int when it is required.
Mike.
On 3 Feb 2007, at 18:09, Matthew Leon Grinshpun wrote:
I have asked this question several days ago on cocoadev, but
have yet to receive a response, here: http://www.cocoadev.com/
index.pl?BindingQuestions
Hence, I turn to you...
How do I bind an NSTextField to an unsigned int?
Some explanation: I want to bind my NSTextField to the
selectionIndex key of an NSArrayController. Apple suggests
(http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Concepts/Troubleshooting.html#//apple_ref/doc/uid/
TP40002148-182420) that I "consider transforming the value
using an NSValueTransformer, or in the specific case of
NSTextField, NSFormatter."
For some reason, I can't wrap my head around what, exactly, I
should do with an NSFormatter to have my NSTextField send an
unsigned int... Likewise, I can't figure out how to program an
NSValueTransformer to send out an unsigned int, since it seem
to have to send out some kind of object and not a primitive
datatype.
Thanks ahead of time,
Matthew
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mikeabdullah.net
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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