Re: Problem with NSOutlineView outlineView:willDisplayCell:forTableColumn:item: delegate method
Re: Problem with NSOutlineView outlineView:willDisplayCell:forTableColumn:item: delegate method
- Subject: Re: Problem with NSOutlineView outlineView:willDisplayCell:forTableColumn:item: delegate method
- From: Tim Hewett <email@hidden>
- Date: Wed, 26 May 2004 20:20:17 +0100
Bill,
On 26 May 2004, at 17:31, email@hidden wrote:
on 2004-05-26 5:08 AM, Tim Hewett at email@hidden wrote:
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.
The -willDisplayCell:forTableColumn:row: delegate method is called
whenever
the outline view thinks it needs to display a cell. Not just when you
select
a cell, but also, for example, when the user scrolls some more rows
into
view or enlarges the window to make more cells visible. I don't know
what
the actual algorithm is, but I do know that this delegate method is
called
very frequently when a user is mousing around in the outline view,
sometimes
when it doesn't seem as though it really needs to redisplay a cell.
Ditto
for table views.
It is up to you to notice which cell is being displayed on the current
call
to this delegate method, and to provide results accordingly.
Very true.
It sounds like
you aren't paying any attention to the row: parameter value that is
passed
into the delegate method. Ditto for the forTableColumn: parameter
value.
The code takes specific note of this information in the delegate
method in fact, but the NSOutlineView actually displays the cell only in
the frame of the row that has been clicked on. I believe it is the
outline
view's internal responsibility to decide on the location and size of the
frame of the cell it would like to draw, to then pass to the cell's
drawWithFrame:inView: method, since only it knows the actual locations
of the rows within the scrollable view.
So the outline view tells my delegate that it will draw a cell for a
row and
a column to allow the delegate to setup the cell accordingly, and it
asks
for rows 7, 8, 9, 10, ... 20 (e.g.) when clicking from row 6 to row 20.
That's
fine, it can do that (it is its right to do when it feels like it), but
the problem
is that if it states it will draw the cell for row 7, 8, etc. then it
should actually
draw the cell in those rows. the problem it, it isn't doing that, it is
drawing
all of them in row 20, one after the other. Hence the checkbox in row 20
flickers between on and off in the scenario described, since all the
other
row states are displayed in it until the actual proper one is reached
and
displayed. I can't control the drawing location, it's all built into
the outline
view...
Apologies if I've misunderstood you.
Try describing it to your mother ;-) I was wondering if others had come
across this and knew whether it is a common programmer's error or a
defect with a workaround. It certainly seems pretty strange.
This happens under 10.2.8 and 10.3.3 incidentally.
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
Regards,
Tim Hewett.
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.