Fwd: Using heightOfRowByItem is NSOutlineView
Fwd: Using heightOfRowByItem is NSOutlineView
- Subject: Fwd: Using heightOfRowByItem is NSOutlineView
- From: Dan Donaldson <email@hidden>
- Date: Tue, 17 Oct 2006 23:01:52 -0400
OK --
So if I understand you correctly, Cocoa makes this automatic, and my
responsibility is to keep the value of the cell up to date - I guess
by getting it from the core data model.
Thanks: I'll try that.
Dan Donaldson
On 17-Oct-06, at 10:55 PM, Doug Knowles wrote:
Dan,
I'm hardly the expert, but I don't think it will help to call this
method on your own; Cocoa has to call it when it needs the result.
In my implementation, after copious use of NSLog, I determined that
the value of the cell in question was not always current for the
specified row when the method was called. My implementation now
finds
the proper value and invokes setObjectValue: on the cell before doing
the calculation. This cleaned up most of the display glitches.
I don't know if it's the right way, but it's more correct than it
was...
Hope this helps.
Doug K;
On 10/17/06, Dan Donaldson <email@hidden> wrote:
With thanks due to I.Savant and Scott Ribe, I've got some results in
dynamically modifying line heights in an NSOutline.
I implemented a delegate for the NSOutlineView, with this:
- (float)outlineView:(NSOutlineView *)outlineView heightOfRowByItem:
(id)item {
NSArray * cols = [outlineView tableColumns];
NSEnumerator * en = [cols objectEnumerator];
id col;
id dcell;
NSSize cellsize;
NSRect bounds;
float highest = 0.0;
while(col = [en nextObject]){
dcell = [col dataCellForRow:[outlineView
rowForItem:item]];
cellsize = [dcell
cellSize]; // will use this later
cellsize.height = 100000000.0;
cellsize.width = 300.00;
bounds.origin = NSZeroPoint;
bounds.size = cellsize;
[dcell setWraps: YES];
cellsize = [dcell cellSizeForBounds:bounds];
if (cellsize.height > highest) {
highest = cellsize.height;
}
NSLog(@"heights: %f %f datacell: %@",
bounds.size.height,
cellsize.height, [dcell objectValue]);
}
return highest;
}
All fine, as far as it goes. But there are drawing errors, and my
conclusion is that I need to invoke this more frequently.
My question: when is - (float)outlineView:(NSOutlineView *)
outlineView heightOfRowByItem:(id)item invoked, and should I be
setting up other delegate methods to call it more frequently? Should
I set up notifications to trap events that occur when editing,
collapsing or resizing? In short, how much does Cocoa handle, and
how
much am I responsible for? Anyone have any documentation on this?
Dan Donaldson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden