• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using heightOfRowByItem is NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using heightOfRowByItem is NSOutlineView


  • Subject: Re: Using heightOfRowByItem is NSOutlineView
  • From: "Doug Knowles" <email@hidden>
  • Date: Tue, 17 Oct 2006 22:55:18 -0400

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:
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


References: 
 >Using heightOfRowByItem is NSOutlineView (From: Dan Donaldson <email@hidden>)

  • Prev by Date: Setting file for an NSDocument
  • Next by Date: Fwd: Using heightOfRowByItem is NSOutlineView
  • Previous by thread: Using heightOfRowByItem is NSOutlineView
  • Next by thread: Fwd: Using heightOfRowByItem is NSOutlineView
  • Index(es):
    • Date
    • Thread