Re: NSOutlineView --> NSTextView
Re: NSOutlineView --> NSTextView
- Subject: Re: NSOutlineView --> NSTextView
- From: Kyle Mandli <email@hidden>
- Date: Mon, 25 Jun 2001 09:11:18 -0500
On Sunday, June 24, 2001, at 06:22 PM, Sandeep Parikh wrote:
Hi,
Within my app I have an NSDrawer containing an NSOutlineView that acts
as a filesystem browser. I want to set it up in a way that when you
select a directory (or multiple directories) from within the
NSOutlineView it will display the full path of it inside an NSTextView
that is in the parent window of the NSDrawer....any thoughts?
-Sandeep
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
I just finished putting together a outline view that had the exact same
specifications as the one you are describing. What I did was to create
a generic object (probably the root unless you want to start out at some
pre-defined starting point like the users home directory) and find all
of its children using:
- (BOOL)fileExistsAtPath:(NSString *)path isDirectory:(BOOL
*)isDirectory
- (NSArray *)directoryContentsAtPath:(NSString *)path
which will allow you test the paths as directories or not and then
subsequently say whether they are expandable or not. With each of these
objects you assign them their path in a string and allow anyone with
these objects to access the path along with any other pertinent
information (like size, file type, etc...) After you would create a new
file node if it was a directory I created an array of objects matching
the previous one and so on down to files. You can also easily weed out
file types and directories you do not want to display this way as well.
After that putting the path into the text view is as easy as dealing
with outline views like finding the selected row and finding the item
corresponding to that row (itemAtRow: I think) and just access the
string of the object. Sorry about the ambiguity of the solution, if you
or anyone else wants the actual code I can send it to you or post it up
on a ftp (it has some proprietary info in the classes but it can easily
be removed.) I hope this helps and again just e-mail me if anyone wants
some source.
Kyle Mandli
Mandli Communications, Inc.
**********************
email@hidden
email@hidden
email@hidden
**********************
**********************
email@hidden
(608)835-3500
**********************