Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Another Cocoa Doc Based App Question

Another Cocoa Doc Based App Question
Thread Tools
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Jan 1, 2007, 05:12 PM
 
Working with a Cocoa Document Based app here....

When I use loadDataRepresentationNSData *)data ofTypeNSString *)aType how can I retrieve the name of the file that was opened? The file may not be opened using the Open panel, it could be opened via the Open Recent menu...

TIA, and Happy New Year!
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Jan 1, 2007, 05:15 PM
 
Sorry, forgot to disable smilies..
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jan 1, 2007, 06:27 PM
 
If you need the file's name in order to read from it (I find that kind of odd, but I'll just trust you here), you'd probably be better off overriding readFromURL:ofType: instead. You can then use the URL to get the file's name.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Jan 1, 2007, 07:01 PM
 
Chuck,

Here's the story: I've got an offscreen view for printing purposes. I am looking to parse the file name in order to provide a title for the printout...
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Jan 1, 2007, 09:16 PM
 
-[NSDocument displayName]

Returns the name of the receiver as displayed in the title bars of the document’s windows and in alert dialogs related to the document.

If the document has been saved, the display name is the last component of the directory location of the saved file (for example, “MyDocument” if the path is “/tmp/MyDocument.rtf”). If the document is new, NSDocument makes the display name “Untitled n,” where n is a number in a sequence of new and unsaved documents. The displayable name also takes into account whether the document’s filename extension should be hidden. Subclasses of NSWindowController can override windowTitleForDocumentDisplayName: to modify the display name as it appears in window titles.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:43 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2