• 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
Re: Custom NSButtonCell and NSTableColumn binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSButtonCell and NSTableColumn binding


  • Subject: Re: Custom NSButtonCell and NSTableColumn binding
  • From: Alexander Lamb <email@hidden>
  • Date: Fri, 18 Aug 2006 18:03:12 +0200

Ok, I tried to progress using mmalc's example of ClockControl2a, however, I am still stuck. I get the idea if I want a Control and a related Cell (as in Clock...). However I want to put the cell in the table column.

From what I see, the only available binding for NSTableColumn is "value". However, this is already used for the "state" of my button. I would like to add "checkColor".

So, does this mean I need to subclass NSTableColumn and implement the "bind... to..." method to handle the "checkColor" binding? Then basically forcing the cell to redraw each time I receive a "observeValueForKeyPath..." call?

What I really don't understand here is:

how does the table view dispatch the bindings notifications to the correct cell since there is only one instance of my custom cell being used? Isn't there a simple example somewhere?

Thanks,

Alex
--
Alexander Lamb
email@hidden



On Aug 18, 2006, at 12:15 PM, Alexander Lamb wrote:

Hello list,

I searched the list and other sites. Many people seem to have the same question but none found the answer. So here it goes:

I have a custome NSButtonCell: an LSColorCheckCell which in addition to having a state ,has a color (checkColor).

I made the cell key-value-coding compliant by implementing the setCheckColor and checkColor accessor methods.

I havn't made a palette yet but in IB I set my column of the NSTableView to a NSButtonCell then choose LSColorCheckCell as the custom cell class.

after loading the nib, I programmatically set the binding between my controller and my NSTableColumn:

[myTableColumn bind:@"checkColor" toObject:myController withKeyPath:@"arrangedObjects.color" options:nil];

Unfortunately, I get the following runtime error:

[Session started at 2006-08-18 12:08:55 +0200.]
2006-08-18 12:09:01.443 PeopleTasks[18281] Exception raised during posting of notification. Ignored. exception: [<LSColorCheckTableColumn 0x360040> valueForUndefinedKey:]: this class is not key value coding-compliant for the key checkColor.
2006-08-18 12:09:01.531 PeopleTasks[18281] *** NSRunLoop ignoring exception '[<LSColorCheckTableColumn 0x360040> valueForUndefinedKey:]: this class is not key value coding- compliant for the key checkColor.' that raised during posting of delayed perform with target 16252a0 and selector 'invokeWithTarget:'


Now this seems logical since it is my cell which is key-value- coding for checkColor, not my table view. Do I need to create a subclass of NSTableView with setCheckColor? if so, what object do I forward the call since obviously it is not the table column keeping the color?

Thanks,

Alex
--
Alexander Lamb
email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Custom NSButtonCell and NSTableColumn binding (From: Alexander Lamb <email@hidden>)

  • Prev by Date: Re: NSPopUpButton inside Table CornerView
  • Next by Date: Re: Custom NSButtonCell and NSTableColumn binding
  • Previous by thread: Custom NSButtonCell and NSTableColumn binding
  • Next by thread: Re: Custom NSButtonCell and NSTableColumn binding
  • Index(es):
    • Date
    • Thread