Joshua
Joshua

Reputation: 15510

How would you make a text cell in a an Outline View show how many children the parent row has?

How would you make Rows that are the Top Parent in an Outline View (which is connected to a NSTreeController) display how many children it has in a Text Cell?

If this is a bit confusing here is a Picture of what I mean.

alt text
(source: sourceforge.net)

I am talking about the number to the right of one of the rows in the circle, which is displaying how many children the parent has.

Upvotes: 0

Views: 276

Answers (2)

Marc Charbonneau
Marc Charbonneau

Reputation: 40517

You can either make a custom NSCell subclass that will show the child count (you would use your model object itself as the cell's object value, instead of providing a separate string or image), or in your data source method for the outline view you could just include the count along with the title string. Of course, you'll have to use the first option if you want it drawn exactly like the screenshot.

Upvotes: 3

Peter Hosey
Peter Hosey

Reputation: 96333

Custom cell, either on that column or on a second column.

Upvotes: 2

Related Questions