[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: open recent in renaissance?
From: |
Tim Schmielau |
Subject: |
Re: open recent in renaissance? |
Date: |
Thu, 13 May 2010 23:55:05 +0100 |
On 13 May 2010, at 19:26, Wolfgang Lux wrote:
> Tim Schmielau wrote:
>
>> Now I just have to figure out how to make those menu entries send openFile:
>> messages...
>
> You don't want to do that. The menu is managed by NSDocumentController, so
> assuming that your application is document based, the document controller
> will handle opening for you (just as if the user had selected the file via
> the open panel). On the other hand, if your application is not document based
> you are rolling on your own and should manage the whole menu yourself. The
> fact that the menu may be populated for non-document based applications at
> present is just an artifact of a (somewhat) poor implementation on my side,
> which is subject to change.
>
> Wolfgang
>
My app is not document based. But that's just what Apple's documentation says
for [NSDocumentController noteNewRecentDocumentURL:]
"NSDocument automatically calls this method when appropriate for
NSDocument-based applications. Applications not based onNSDocument must also
implement the application:openFile: method in the application delegate to
handle requests from the Open Recent menu command."
I can't at the moment find the Apple sample code where I derived this from. But
my app does just these two things:
[[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL:[NSURL fileURLWithPath: filename]]; to add entries to
the recent documents menu,
and implement - (BOOL)application:(NSApplication *)theApplication
openFile:(NSString *)filename to open files.
It works flawlessly on OS X.
Tim
- Re: open recent in renaissance?, (continued)
- Re: open recent in renaissance?, Fred Kiefer, 2010/05/10
- Re: open recent in renaissance?, Doug Simons, 2010/05/10
- Re: open recent in renaissance?, David Wetzel, 2010/05/10
- Re: open recent in renaissance?, Fred Kiefer, 2010/05/11
- Re: open recent in renaissance?, David Wetzel, 2010/05/11
- Re: open recent in renaissance?, Tim Schmielau, 2010/05/11
- Re: open recent in renaissance?, David Wetzel, 2010/05/11
- Re: open recent in renaissance?, Tim Schmielau, 2010/05/13
- Re: open recent in renaissance?, Wolfgang Lux, 2010/05/13
- Re: open recent in renaissance?,
Tim Schmielau <=
- Re: open recent in renaissance?, Wolfgang Lux, 2010/05/14
- Re: open recent in renaissance?, Tim Schmielau, 2010/05/14