Using heightOfRowByItem is NSOutlineView
Using heightOfRowByItem is NSOutlineView
- Subject: Using heightOfRowByItem is NSOutlineView
- From: Dan Donaldson <email@hidden>
- Date: Tue, 17 Oct 2006 21:40:26 -0400
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:
This email sent to email@hidden