Outline View drawing changes in Leopard?
Outline View drawing changes in Leopard?
- Subject: Outline View drawing changes in Leopard?
- From: "Doug Knowles" <email@hidden>
- Date: Sat, 24 Nov 2007 16:40:36 -0500
I'm seeing some new drawing behaviors in Leopard that are wreaking havoc on
some of the hackery I put in place under Tiger.
I'm using an NSOutlineView with variable row heights (hack #1), and I've
implemented a custom table column data cell that uses an NSTableView to
render a mini-table within some of the columns in the view (hack #2). (My
"MultiRowSubviewCell" is based loosely on some sample code published by Joar
Wingfors a few years ago; more on the implementation below.)
At first, my view renders normally. If I instrument the code, it renders
each row in sequence, and the columns in sequence within the row, once per
redraw, invoking drawWithFrame:inView once per cell.
But if I edit a cell (a "normal" NSTextFieldCell) in the view and complete
the edit, the drawing behavior goes south: it renders each row normally, but
on the last row, within a call to -display on my inner table view, the
outline view starts rendering the remaining columns from the top, and when
it gets to the last row of the inner loop, it starts another inner loop on
the remaining columns, and so on. This agony is repeated every time it
encounters a last row. It's not infinite recursion, but it's one or two
orders of magnitude too many calls, and it makes the application unusable.
So, the bad rendering pattern is:
First row, first column
First row, 2nd column
...
Next to last row, last column
Last row, first column
First row, 2nd column (again)
First row, 3rd column
...
Last row, 2nd column
First row, 3rd column (yet again)
...
Last row, 3rd column
First row, 4th column
...
Last row, 4th column
Last row, 4th column
Last row, 3rd column
First row, 4th column
....
Last row, 4th column
Last row, 2nd column
First row, 3rd column
ad nauseum
A few things I've tried to make sense of:
- What is the significance of editing a cell to trigger the bad behavior? I
assume it's related to the first invocation of the window's field editor...
- What is the correct way under Leopard to implement a cell that uses a
subview to render itself? My cell's drawWithFrame:inView method...
- fetches the prepared subview from a controller object
- sets its frame to the specified rectangle
- if necessary, adds it as a sub-view to the view it's being rendered in
- invokes display on it
- invokes removeFromSuperviewWithoutNeedingDisplay (not in Joar's
sample code, but which I found necessary by trial and error)
- Why would a table view re-render most of itself from within a single
(admittedly non-standard) cell's drawWithFrame:inView method?
Thanks for any thoughts...
Doug K;
_______________________________________________
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