• 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: NSBrowser: so very, very broken
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBrowser: so very, very broken


  • Subject: Re: NSBrowser: so very, very broken
  • From: "John C. Randolph" <email@hidden>
  • Date: Sat, 25 Jan 2003 20:46:34 -0800

On Saturday, January 25, 2003, at 02:40 AM, j o a r wrote:

On Saturday, Jan 25, 2003, at 01:54 Europe/Stockholm, Clark Mueller wrote:

I pretty much went into cardiac arrest after I found out how much work NSBrowser involves for so little in return. I've gone about writing all of the stuff I need almost completely from scratch. NSBrowser simply doesn't pull its weight for most of the places in which it might be practically applied. It's annoying.

I beg to differ. Provided that you already have a tree of data - the prerequisite for a browser / outline view - the implementation of the delegate / data source for a browser is _not_ much more cumbersome or even different than the code you have to write for a table view.

[code example snipped]

I'll just mention as well, that when I wrote my Obj-C runtime hierarchy browser back before I took this job at Apple, my browser delegate methods came to just:

@implementation RuntimeBrowserDelegate

- (int)browser:(NSBrowser *)sender numberOfRowsInColumn:(int)column;
{
ClassEnumerator
*enumerator = (column == 0 ? [ClassEnumerator rootClassEnumerator] :
[ClassEnumerator subclassEnumeratorForClass:NSClassFromString([[sender selectedCellInColumn:column-1] title])]);
return [enumerator countRemainingObjects];
}

- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column
{
NSArray
*classNames = (column == 0 ?
[[ClassEnumerator rootClassEnumerator] sortedNames] :
[ClassEnumerator sortedSubclassNamesForClassNamed:[[sender selectedCellInColumn:column-1] title]]);

[cell setTitle:[classNames objectAtIndex:row]];
[cell setLeaf:!classHasDescendants(NSClassFromString([cell title]))];
}

@end

The bulk of the work was implementing my ClassEnumerator class (which is still only about 300 lines of code, including a bunch of stuff for caching lookups already performed, etc.)

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: NSBrowser: so very, very broken (From: j o a r <email@hidden>)

  • Prev by Date: Non-working NSButtonCells (can change state even is not enabled)
  • Next by Date: Re: Non-working NSButtonCells (can change state even is not enabled)
  • Previous by thread: Re: NSBrowser: so very, very broken
  • Next by thread: Re: NSBrowser: so very, very broken
  • Index(es):
    • Date
    • Thread