• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Binding (KVC/KVO) for C struct datatypes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding (KVC/KVO) for C struct datatypes


  • Subject: Binding (KVC/KVO) for C struct datatypes
  • From: "Rudolph van der Merwe" <email@hidden>
  • Date: Thu, 4 Oct 2007 15:12:22 +0200

I'm trying to create the following programatic binding:

[view bind:@"frame.size.width" toObject:self withKeyPath:@"width" options:nil];

Both view and width are instance variables in my controller object declared as:

NSImageView * view;
float width;

In other words, I'm trying to bind the frame width of the NSImageView
to a float ivar in my object.

This doesn't seem to work: I get the following runtime error:

An uncaught exception was raised
[<NSConcreteValue 0x145a60> valueForUndefinedKey:]: this class is not
key value coding-compliant for the key size.
*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<NSConcreteValue 0x145a60> valueForUndefinedKey:]: this
class is not key value coding-compliant for the key size.'

It seems the problem here is that [view frame] returns a NSRect
C-struct which has a size field which itself is a NSSize C-struct,
which has a float field 'width'. I was hoping that KVC can parse [view
frame].size.width using the @"frame.size.width" key-path. This doesn't
seem to be the case.

How does one implement bindings (or general KVC/KVO) for C-structs ?
_______________________________________________

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

  • Follow-Ups:
    • Re: Binding (KVC/KVO) for C struct datatypes
      • From: Charles Steinman <email@hidden>
    • Re: Binding (KVC/KVO) for C struct datatypes
      • From: Charles Steinman <email@hidden>
    • Re: Binding (KVC/KVO) for C struct datatypes
      • From: Dominik Pich <email@hidden>
  • Prev by Date: Re: Distinguish between Directory and File
  • Next by Date: Z_OPT field in coredata sqlite database. What it is for?
  • Previous by thread: Re: Cocoa based "volume format panel" like the DRBurnSetupPanel class
  • Next by thread: Re: Binding (KVC/KVO) for C struct datatypes
  • Index(es):
    • Date
    • Thread