Re: Binding (KVC/KVO) for C struct datatypes
Re: Binding (KVC/KVO) for C struct datatypes
- Subject: Re: Binding (KVC/KVO) for C struct datatypes
- From: Charles Steinman <email@hidden>
- Date: Thu, 4 Oct 2007 11:48:39 -0700 (PDT)
Apologies, Yahoo Mail decided to send my last message
before I actually wrote the third point. Here's what I
was trying to say:
--- Rudolph van der Merwe <email@hidden> wrote:
> I'm trying to create the following programatic
> binding:
>
> [view bind:@"frame.size.width" toObject:self
> withKeyPath:@"width" options:nil];
There are several problems with this:
1. KVC is a feature of Cocoa -- only Cocoa classes can
implement it. A C struct is not a Cocoa class, so you
can't use KVC to access its members.
2. You can't bind a keypath even if all the segments
in it are KVC-compliant. The binding argument has to
be an exposed binding of the object you're sending the
message to.
3. I don't believe "frame" is an exposed binding of
NSView, so you probably shouldn't try to bind it.
You could pretty easily create an NSImageView subclass
that allows this binding, but I would try reading up
on Bindings a little more first.
Cheers,
Chuck
____________________________________________________________________________________
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!
http://tv.yahoo.com/collections/3658
_______________________________________________
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