• 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: OutlineEdit example (outlineView:heightOfRowByItem:)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: OutlineEdit example (outlineView:heightOfRowByItem:)


  • Subject: RE: OutlineEdit example (outlineView:heightOfRowByItem:)
  • From: Keith Blount <email@hidden>
  • Date: Mon, 2 May 2005 15:32:43 -0700 (PDT)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

Having played around some more, the problem I seem to
be having with this is that the item passed into the
outlineView:heightOfRowByItem: delegate method is of a
private _NSArrayControllerTreeNode class, which means
I can do nothing with it. I therefore need to get the
value in the cell at this position, but that is more
difficult than it seems. I thought I would be able to
do it like this:

NSString *contents = [[[outlineTreeController
arrangedObjects] objectAtIndex:[outlineView
rowForItem:item]] valueForKey:@"contents"];

However, it seems that NSTreeController's
arrangedObjects does not return a simple NSArray -
instead, it returns a private class called
_NSControllerTreeProxy - which doesn't respond to
objectAtIndex:...

This is driving me nuts now... There must be an easy
way to get the value of an object stored at a
particular row and column within an outline view that
uses NSTreeController and bindings, and I must be
missing the obvious...

If anyone could point me in the right direction, I
would be very grateful.

Thanks again,
Keith

---- ORIGINAL MESSAGE ----

Hmm, still struggling with this...

In theory, you should be able to use the new variable
height delegate methods of NSOutlineView and
NSTableView to support arbitrary heights depending on
content, but I am getting some very odd drawing errors
when doing this in an editable outline view. I am
trying to add the outlineView:heightOfRowByItem:
delegate method to the new (Core Data) OutlineEdit
example, but the drawing and selection is going mad. I
have set MyDocument as the delegate and added these
delegate methods:

- (float)outlineView:(NSOutlineView *)outlineView
heightOfRowByItem:(id)item
{
   NSTableColumn *tabCol = [[outlineView tableColumns]
objectAtIndex:0];
   float width = [tabCol width];
   NSRect r = NSMakeRect(0,0,width,1000.0);
   NSCell *cell = [tabCol dataCellForRow:[outlineView
rowForItem:item]];
   float height = [cell cellSizeForBounds:r].height;
   if (height <= 0) height = 16.0;
   return height;
}

- (void)outlineView:(NSOutlineView *)outlineView
willDisplayCell:(id)cell forTableColumn:(NSTableColumn
*)tableColumn item:(id)item
{
   [cell setWraps:YES];
}

Does anybody know how to do this, or why these methods
would be causing such weird drawing errors?

Many thanks in advance,
Keith

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
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

  • Follow-Ups:
    • Re: OutlineEdit example (outlineView:heightOfRowByItem:)
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Re: Temporarily Editable NSTextField
  • Next by Date: Re: Anyone using OCUnit with Tiger/XCode 2.0?
  • Previous by thread: RE: OutlineEdit example (outlineView:heightOfRowByItem:)
  • Next by thread: Re: OutlineEdit example (outlineView:heightOfRowByItem:)
  • Index(es):
    • Date
    • Thread