• 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: How to indent in NSOutlineView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to indent in NSOutlineView?


  • Subject: Re: How to indent in NSOutlineView?
  • From: John Terranova <email@hidden>
  • Date: Tue, 08 Jul 2008 15:26:07 -0700

The most likely solution, off the top of my head, would involve subclassing the NSOutlineView and overriding some method to tell Cocoa to indent some rows more than others.

Here is one possibility. I don't know that it works, but it might. Try it and see.

// you would need to subclass NSOutlineView, if you haven't already and override this method
- (NSInteger)levelForItem:(id)item
{
NSInteger level = [super levelForItem:item];
if ([item needsExtraIndenting] == YES) // whatever your test is here
level++;


	return level;
}

Another possibility would involve overriding something else, maybe like this:

 - (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row
{
	NSRect rc = [super frameOfCellAtColumn:column row:row];

if ([[self itemAtRow:row] needsExtraIndenting] == YES) // whatever your test is here
{
CGFloat indent = [self indentationPerLevel];
rc.origin.x += indent;
rc.size.width -= indent;
}
return rc;
}


Again, I don't know that this works, but this is the type of solution I would look for first. Look through NSOutlineView.h and NSTableView.h for interesting methods that you can override and customize. That's what I did to find these two.

	john

On Jul 8, 2008, at 3:48 AM, Aman Alam wrote:

Is there a way to indent main headings in NSOutlineView as follows: -



Heading 1

Item

           Item

Heading 2

Item

Heading 2.1

Item

                       Item

Heading 3

Item



I tried many ways to indent the headings but not succeeded. The disclosure triangle doesn't indent with headings. I required heading within heading and the heading should be independent of its parent heading. The parent heading may contain any number of items within.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to indent in NSOutlineView?
      • From: "Aman Alam" <email@hidden>
References: 
 >How to indent in NSOutlineView? (From: "Aman Alam" <email@hidden>)

  • Prev by Date: Re: MIDI Sequencing
  • Next by Date: Re: [NSTextStorage/NSAttributedString] How can we know the height of a rendered string?
  • Previous by thread: How to indent in NSOutlineView?
  • Next by thread: Re: How to indent in NSOutlineView?
  • Index(es):
    • Date
    • Thread