• 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: Source list group item indentation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Source list group item indentation


  • Subject: Re: Source list group item indentation
  • From: Ben <email@hidden>
  • Date: Wed, 16 Jan 2008 18:55:22 +0000


On 16 Jan 2008, at 18:08, Corbin Dunn wrote:


On Jan 16, 2008, at 2:23 AM, Kyle Sluder wrote:

(Sorry if you're getting this twice, I'm an idiot and forgot to set
the From option.)

On Jan 15, 2008 6:15 PM, Corbin Dunn <email@hidden> wrote:
I realize the release notes are rather long, but they are a good read.
Especially for controls/components that you use.

I did read them, but obviously not closely enough. ;)

To be honest, this seems like The Wrong Way(tm) to do it. It seems
far more appropriate for the delegate to provide this information, and
thus suffer from the tight coupling with the data source. Filed as r.
5690092.

Thank you for logging the bug! This is the best way to get things like this changed.


For others, Kyle is basically asking that the option to show a disclosure triangle be determined by a delegate method. That is an excellent it, and it is something we have wanted to do. It was more of a timing issue for why it wasn't done.

thanks,
corbin


I'm a little unsure of the netiquette here, as I have a nice solution BUT *it is someone else's code* and I don't know who/where from! Explanation follows, but please don't credit me for it.


Subclass NSOutlineView, and override the following method:

- (NSRect)frameOfOutlineCellAtRow:(NSInteger)row
{
// Default to show triangle
BOOL showTriangle = YES;

// See if delegate responds to new selector
if ([[self delegate] respondsToSelector :@selector(outlineView:shouldShowDisclosureTriangleForItem:)])
{
// Perform selector using objc_msgSend() to avoid compiler warnings
SEL selector = @selector(outlineView:shouldShowDisclosureTriangleForItem:);
id item = [self itemAtRow:row];

showTriangle = (objc_msgSend([self delegate], selector, self, item) ! = 0x00);
}

if (!showTriangle)
{
// If not showing triangle, return empty rect
return NSZeroRect;
}
else
{
// else return default value
return [super frameOfOutlineCellAtRow:row];
}
}



Then, replace your outline views in IB with your custom one, and the delegate can implement:


- (void)outlineView:(NSOutlineView *) shouldShowDisclosureTriangleForItem:(id)item

to decide whether or not to show the triangle.

--Ben
_______________________________________________

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: Source list group item indentation
      • From: "Hamish Allan" <email@hidden>
    • Re: Source list group item indentation
      • From: Corbin Dunn <email@hidden>
References: 
 >Re: Source list group item indentation (From: Jonathan Dann <email@hidden>)
 >Re: Source list group item indentation (From: Corbin Dunn <email@hidden>)
 >Re: Source list group item indentation (From: "Kyle Sluder" <email@hidden>)
 >Re: Source list group item indentation (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: NSLog broken after call of NSTask and setStandardError
  • Next by Date: Re: Handle Dock menu open/close events
  • Previous by thread: Re: Source list group item indentation
  • Next by thread: Re: Source list group item indentation
  • Index(es):
    • Date
    • Thread