Re: Drawing a badge in an OutlineView column cell: but width changes on expanding
Re: Drawing a badge in an OutlineView column cell: but width changes on expanding
- Subject: Re: Drawing a badge in an OutlineView column cell: but width changes on expanding
- From: Corbin Dunn <email@hidden>
- Date: Tue, 24 Feb 2009 12:51:21 -0800
On Feb 24, 2009, at 12:38 PM, Stuart Malin wrote:
I have been reading various blogs, tried to search CocoaBuilder, and
have ben looking at the code in Apple's PhotoSearch sample, but am
not clear about the best way to handle this situation:
I have an NSOutlineView for which I have set a custom cell (sub
class of NSTextViewCell) in order to draw a badge on the right side
of the cell.
I have overridden drawInteriorWithFrame:controlView: to do my
drawing there. It seems to me that when a row that has descendent
nodes is expanded, the width of the hierarchically containing cells
(lower level value) are made wider (by the same amount as the
indentation). Both the indented cells (by their indentation) and the
higher order cells (by the increased cell width) now have their
right side pushed partway out of the viewable area of the column.
So, I can't determine the x position of the badge based upon the
width of the cell (a hierarchically outer cell with no indent has an
increased width, yet to calculate a proper x coordinate, the cell
would need to know that some other table items are expanded; how
could it "know" this?)
My best idea so far is to determine the position based on the table
column's width, and take into account the indent level. But I
suspect there are any of a number of ways to handle this, and so am
looking for guidance on a best practice from those with experience.
TIA.
You should just draw the badge in -drawInteriorWithFrame, and
everything should work provided you are right-aligning it with the
frame passed to you. What does your code look like? Maybe it has some
errors/problems.
.corbin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden