Re: filtering contents for NSBrowser
Re: filtering contents for NSBrowser
- Subject: Re: filtering contents for NSBrowser
- From: Scott Anguish <email@hidden>
- Date: Sat, 10 Aug 2002 05:11:16 -0400
On Saturday, August 10, 2002, at 02:48 AM, Donald S. Hall wrote:
I want the user to be able to browse through the computer's
directories/folders, but I don't want to show every folder and file -
only
files of a specified type (as specified by an HFS creator type or file
extension) in a visible directory/folder. Is there any way to do this?
The
Simple Browser example seems to show everything, even invisible
directories
and files. So far I haven't been able to find any methods for doing
this in
the docs. Note that I don't want to open the file that is ultimately
selected - I only want to save its path for later use.
Look in FSNodeInfo.m of the SimpleBrowser example.
Specifically, the method
- (BOOL)isVisible {
// Make this as sophisticated for example to hide more files you
don't think the user should see!
NSString *lastPathComponent = [self lastPathComponent];
return ([lastPathComponent length] ? ([lastPathComponent
characterAtIndex:0]!='.') : NO);
}
which explictly says, that you can modify how this works here.. right
now it only eliminates files that start with .
you could change that trivially to include files that begin with A
- (BOOL)isVisible {
// Make this as sophisticated for example to hide more files you
don't think the user should see!
NSString *lastPathComponent = [self lastPathComponent];
if ([lastPathComponent length])
{
if ([lastPathComponent characterAtIndex:0]!='.')
return NO;
if ([lastPathComponent characterAtIndex:0]!='A')
return NO;
}
}
_______________________________________________
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.