Pointing OutlineView to a folder on the Desktop
Pointing OutlineView to a folder on the Desktop
- Subject: Pointing OutlineView to a folder on the Desktop
- From: David Yamartino <email@hidden>
- Date: Wed, 18 Mar 2009 21:15:43 +1000
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@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