Problem with NSOutlineView outlineView:willDisplayCell:forTableColumn:item: delegate method
Problem with NSOutlineView outlineView:willDisplayCell:forTableColumn:item: delegate method
- Subject: Problem with NSOutlineView outlineView:willDisplayCell:forTableColumn:item: delegate method
- From: Tim Hewett <email@hidden>
- Date: Wed, 26 May 2004 10:08:29 +0100
Hi,
I have a NSOutlineView of one column, which is displaying a custom cell,
a "ButtonAndTextCell" where there is a checkbox followed by text,
similar
to what iTunes shows in its song names column.
It's all working fine but NSOutlineView is behaving quite strangely when
selecting individual rows. The scenario is this:
row 4: checkbox OFF
row 5: checkbox OFF
row 6: checkbox ON
row 7: checkbox OFF
If I click on row 7, the willDisplayCell: delegate method is called for
that row
as expected - the cell is setup to display the unchecked checkbox and
associated text and it is displayed fine. The same happens when clicking
on row 4, all ok, but then if I click back on row 7, it temporarily
displays a
checked checkbox which then (within a blink) becomes unchecked again
and stays unchecked. It only does this when clicking a lower row from
the
previously selected one, and only if one of the rows between them is
displaying a checked checkbox.
Adding a debug printf to
outlineView:willDisplayCell:forTableColumn:item:
shows that when clicking from row 7 to row 4 (or more generally, when
clicking from a row lower down the column to one higher up), the
willDisplayCell: method is only called for the newly selected row. But
when
selecting row 7 after row 4, willDisplayCell: is called for rows 4, 5,
6 then
7 but each time displaying the cell only in row 7. So it displays an
unchecked checkbox, then again, then a checked checkbox, then finally
an unchecked checkbox, and so the row 7 checkbox temporarily shows
the row 6 checked state (which it shouldn't).
In general, it seems that so long as the two rows are both visible at
the
same time, selecting a lower row after a higher one results in
willDisplayCell:
being called for all the intermediate rows, with their cell states each
being
displayed in the selected row's cell. Here I clicked on row 38 when row
20
was the previous selection:
willDisplayCell for row 20, state is 1
willDisplayCell for row 21, state is 1
willDisplayCell for row 22, state is 1
willDisplayCell for row 23, state is 1
willDisplayCell for row 24, state is 1
willDisplayCell for row 25, state is 1
willDisplayCell for row 26, state is 1
willDisplayCell for row 27, state is 1
willDisplayCell for row 28, state is 1
willDisplayCell for row 29, state is 1
willDisplayCell for row 30, state is 1
willDisplayCell for row 31, state is 1
willDisplayCell for row 32, state is 1
willDisplayCell for row 33, state is 1
willDisplayCell for row 34, state is 1
willDisplayCell for row 35, state is 1
willDisplayCell for row 36, state is 1
willDisplayCell for row 37, state is 1
willDisplayCell for row 38, state is 0
Row 38 temporarily showed checked, then finally ended showing its
correct
unchecked state.
All delegate methods responding to selection changes do nothing, i.e. in
case they could have been influencing the outline view's behaviour they
have
all had return; put at the top of them to make sure they can't be the
cause. The
behaviour remains.
Anyone got an idea what is going on here? The issue is more of an
aesthetic
one rather than it disrupting behaviour, but it looks bad and isn't
what a user
would expect to see, and as far as I can see NSOutlineView is not
behaving
correctly.
Cheers,
Tim.
http://www.coolatoola.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.