Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

caveman_uk

Guest
Original poster
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
I'm thinking of creating an inspector window in one of my apps. I'd like it to act like the inspector windows in MS Word, omnioutliner et al - i.e. to have collapsable sections. To me, this looks like it should be a custom NSOutlineView subclass with custom NSViews for the 'children'.

Does anyone have any other ideas or know of any example source code for this?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
I don't think you want to use NSOutlineView as your starting point. It is basically an NSTableView and as such it does not contain subviews. Each coloum/row is an NSCell. You are going to have to do a ton of work to get it to allow you to use NSViews instead.

I would define an NSView subclass that displayed the title/show hide disclosure triangle. Give it some behaviour so as the triangle works as expected (either remove the subview or hide it depending on which OSs you want to support). The view could also automatically resize it's containing NSWindow by the correct amount.

Then tart it up with animation of the window resize (really easy) and fading of the hiding view in out (easy on 10.4, a bit more difficult on 10.3).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.