Thanks, Corbin.
Yes, I had misunderstood "rootItem" and that was the problem.

David

On Fri, Mar 20, 2009 at 1:29 AM, Corbin Dunn <[email protected]> wrote:

> Modify the rootItem method in FileSystemItem to be the root path that you
> are interested in. That's the model object, which you need to change. The
> code below is the controller object, and is simply controlling the view.
>
> .corbin
>
>
> On Mar 18, 2009, at 4:19 AM, David Yamartino wrote:
>
>  Below is the code  for "OutlineView" (on your machine in
>> Developer/Examples/AppKit/OutlineView). It presents an expandable view of
>> everything on your machine from  /  (root).
>> How would I point  this app to look at a specific folder (say "Library")
>> located on the desktop?
>>
>> I've experimented,  but can't figure out how to identify the path as this:
>>
>> * /Users/k2/Desktop/Library*
>>
>> as  opposed to
>>
>> *  / (root).*
>>
>> I don't want to see everything on my machine, just what's in the folder.
>>
>> I appreciate your your help.
>>
>>
>> =-=-==-=-=-==- ======================
>>
>>
>> #import "DataSource.h"
>>
>> #import "FileSystemItem.h"
>>
>>
>> @implementation DataSource
>>
>>
>> // Data Source methods
>>
>>
>> - (NSInteger)outlineView:(NSOutlineView *)outlineView
>> numberOfChildrenOfItem:(id)item {
>>
>>   return (item == nil) ? 1 : [item numberOfChildren];
>>
>> }
>>
>>
>> - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
>> {
>>
>>   return (item == nil) ? YES : ([item numberOfChildren] != -1);
>>
>> }
>>
>>
>> - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index
>> ofItem:(id)item {
>>
>>   return (item == nil) ? [FileSystemItem rootItem] :
>> [(FileSystemItem*)item
>> childAtIndex:index];
>>
>> }
>>
>>
>> - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(
>> NSTableColumn *)tableColumn byItem:(id)item {
>>
>>   return (item == nil) ? @"/" : (id)[item relativePath];
>>
>> }
>>
>>
>> // Delegate methods
>>
>>
>> - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(
>> NSTableColumn *)tableColumn item:(id)item {
>>
>>   return NO;
>>
>> }
>>
>>
>> @end
>> _______________________________________________
>>
>
>
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to