Change Displayed Text SizeGrow Displayed Text SizeShrink Displayed Text Size

Tuesday, May 06, 2003

NSDisclosureButton.... conquered.

Some of you might have noticed this little button all over MacOS X since at least 10.1:

We're talking about the little arrow on the right that when clicked drops down a detailed view of your files. You might have also noticed that you never see it in non-Apple applications unless it's in a File dialog. For whatever reason, Apple decided not to make that widget available to developers outside of Apple.

This is one of the things I really do not like about "the new Apple" but I don't want to get on a rant here.
The class that creates that button is the private AppKit class "NSDisclosureButtonCell". Once you know the name of the class you can actually use it without much trouble, though it's a little tricky. After some playing around, I have a working example (note: just the button, not the disclosable view behavior - for that, use [DisclosableView]). You can download the source and ProjectBuilder project [here].
I'll probably update it soon with a fallback class so that if NSDisclosureButtonCell is not available, the button would still be functional. The source is free to use, and if you have comments or improvement, please let me know.

5/06/2003 10:33:00 PM ] [  0 comments  ]
A good quick laugh