On Dec 19, 2008, at 2:30 PM, Eric Gorr wrote:


On Dec 19, 2008, at 5:20 PM, Corbin Dunn wrote:


On Dec 19, 2008, at 1:35 PM, Eric Gorr wrote:

I only have a single column in my NSOutlineView.

The outline view looks like:

> Collapsible Row 1
 Item 1

> Collapsible Row 2
 Item 2

I need the height of a row an of an item displayed when the disclosure triangle is clicked to be based on the width of the cell.

I can get the indentation level by doing:

NSInteger level = [outlineView levelForItem:item];

and the amount that is indented per level by doing:

CGFloat indentation = [outlineView indentationPerLevel];                


Asking for the width of the column does not return the same width of the bounds parameter when drawInteriorWithFrame is called for my cell.


What looks like could work is to get the frame of the NSOutlineView and then subtract the width of the frame by:

 indentation * (level + 1)

but this doesn't seem like it should be the right answer.


There doesn't seem to be a method I can call to obtain the bounds that will be passed into drawInteriorWithFrame for my cell. Have I missed something?


-frameOfCellAtColumn:row: is exactly what will be passed to your cell.

Unfortunately, this does not work as calling this function causes heightOfRowByItem to be called. So, an endless loop is entered.

Yes, of course...since it needs to know the height, but it does answer your question of how to obtain the bounds that are passed to drawInteriorWithFrame:.




I just need to know the width so I base the height on the width.


For that, you want to use -cellSizeForBounds: -- pass in a large height, but a constrained width. Use a width that is equal to the [tableColumn width] minus indentation * (level + 1) ---- although, the actual value that outlineview uses for indentation is dependent on some internal logic (ie: if you are using "group rows", or the "source list highlighting style"). But, this should give you a value that is fairly close to what you want.

corbin



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to