• 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 00:36:02 +0000

OK, thanks very much for the help guys. I've got things a little clearer in my head now.

Basically, as far as I can make out, NSTableView is in charge of drawing itself. Whenever it knows that a particular cell or cells needs drawing, then it sets its single instance of the data cell to the appropriate values and asks that cell to draw itself.

So, what I really need now, is to get my bindings to work properly! When preparing to draw a cell, the setObjectValue is called (of my cell) to set the object value of the cell to the value that needs to be drawn. This is OK, and my cell displays this nicely.

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.

So can anyone tell me how to ask the NSArrayController to set the objectValue to the one the user has just chosen?

Mike.

On 5 Mar 2006, at 09:41, Greg Herlihy wrote:

An NSTableColumn happens to use the same cell to draw all of its rows, but
there is no inherent reason why it must do so.


And in fact a subclass of NSTableColumn would be free to implement
dataCellForRow: how ever it liked: it could well decide to return one of
several different types of cells, say, based upon the type of data
represented in the row being rendered. Or the table column class could go
further and return a unique cell for each row, although the overhead of
doing so could become an issue for large tables.


Now granted, most programs don't need to subclass NSTableColumn. But if the
program does have special table requirements that require having more than
one cell to display all the rows in a column, then implementing a subclass
of NSTableColumn would be one solution.


Greg

On 3/4/06 9:22 PM, "John C. Randolph" <email@hidden> wrote:


On Mar 4, 2006, at 4:43 PM, Mike Abdullah wrote:

  How do I get NSArrayController to properly set up and manage a
seperate instance of MyCustomCell for each row of the table?

You don't.

TableViews only use one cell per column.

-jcr

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

  • Prev by Date: Re: problem with subclassing a cluster class
  • Next by Date: Re: Fastest Datastore?
  • Previous by thread: Re: Help with custom NSCell and Bindings in Table View
  • Next by thread: Re: Help with custom NSCell and Bindings in Table View
  • Index(es):
    • Date
    • Thread