• 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: Help with custom NSCell and Bindings in Table View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with custom NSCell and Bindings in Table View


  • Subject: Re: Help with custom NSCell and Bindings in Table View
  • From: Mike Abdullah <email@hidden>
  • Date: Mon, 6 Mar 2006 22:21:36 +0000

Thanks very much for all the help I've received with this. In the end I've gone for a slightly strange solution, but one that seems to work very nicely for me.

My tableColumn is bound to "properties" of my array object

"properties" is a dictionary, containing the value of the various controls within the NSCell. It also has a contains an NSView that holds each of the controls for that tableCell.

That NSView is loaded from disk when the object is created.

The NSTableColumn of my table is bound to the key path "properties" and uses my custom NSCell. This way, when setObjectValue is called of the NSCell, the cell is sent a dictionary of properties including the cell's associated view.

When the table requests that the cell draw itself, it instead places the view within the TableView in the area the cell covers.

I am then using target and action to directly set the instance variables of the object from the cell.

Mike.

On 6 Mar 2006, at 09:02, mmalcolm crawford wrote:


On Mar 5, 2006, at 4:36 PM, Mike Abdullah wrote:

The problem is then using my cell to set the value that the cell represents. I can't figure out how to do this. If I call setObjectValue: of the cell at the appropriate time, then this doesn't get passed back to my NSArrayController, and on the next redraw, the cell reverts back to its original appearence.

This is expected behaviour:
<http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/Concepts/Troubleshooting.html#//apple_ref/doc/uid/ TP40002148-182467>


See <http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/Concepts/HowDoBindingsWork.html> for more about how bindings work, and:
<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>
("Clock Control") for an example (work in progress) of a cell that uses bindings.


mmalc

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


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: 
 >Re: Help with custom NSCell and Bindings in Table View (From: Greg Herlihy <email@hidden>)
 >Re: Help with custom NSCell and Bindings in Table View (From: Mike Abdullah <email@hidden>)
 >Re: Help with custom NSCell and Bindings in Table View (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: NSTextView - typing attributes not applied to first character typed?
  • Next by Date: Re: Subclassed tableView no longer responding to draggingEntered
  • Previous by thread: Re: Help with custom NSCell and Bindings in Table View
  • Next by thread: NSOutlineView selectedRow error?
  • Index(es):
    • Date
    • Thread