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 > How to double-click to open a document in my Cocoa application?

How to double-click to open a document in my Cocoa application?
Thread Tools
Registered User
Join Date: Jul 2006
Status: Offline
Reply With Quote
Apr 24, 2006, 07:06 PM
 
I need to have my document-based Cocoa application load a file upon double-clicking in the Finder. I understand how to tell Finder to use my application as default for the filetype I need. Currently, I have written the code to open files via the File..Open.. menu, but if I double click an applicable document file, my application starts, but does not load the file.

I know this has got to be a pretty basic question, but I have been unable to find any documentation or other online info out there that tells me how to do this.
     
Mac Enthusiast
Join Date: Nov 2003
Status: Offline
Reply With Quote
Apr 26, 2006, 04:52 PM
 
You should be looking at Apple's documentation for NSApplication (see the "Opening files" section). There are a number of delegate methods that you can implement to handle file opening, including:

Code:
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)fileName;
     
   
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 09:38 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