Re: implementing a Viewer for file type (NOT Editor!)
Re: implementing a Viewer for file type (NOT Editor!)
- Subject: Re: implementing a Viewer for file type (NOT Editor!)
- From: Ondra Cada <email@hidden>
- Date: Tue, 21 Aug 2001 21:42:24 +0200
tknowlto,
>
>>>>> email@hidden (t) wrote at Tue, 21 Aug 2001 12:27:46 -0600:
t> So, my situation is this: I am attempting to construct a Viewer
t> application, but when I start the app, an "Untitled1" document is
t> created. I want NSDocument's to be created in my app only for
t> pre-existing data.
t>
t> I tried overriding MyDocument's -init to always fail, thinking that
t> -initWithXYZ are the more appropriate initializers for my case, but
t> apparently at some depth those all filter down to -init.
t>
t> I tried also overriding -(BOOL)loadDataRepresentation:ofType: to check
t> that its data argument is non-nil, but that wasn't the ticket, either.
t>
t> I'm hoping to avoid having to subclass NSDocumentController, though I'm
t> starting to think that's the only way to prevent new document creation
t> actions from succeeding.
Have you set properly in the info plist that the application is a Viewer,
not an Editor for the document type?
If so and it still makes new docs (I have never tried yet an app which is a
viewer only, so I don't know whether it is implemented properly or not),
well, I guess the only way is to use this plain category
// MIGHT NOT BE COMPATIBLE WITH FUTURE OS X RELEASES!
@interface NSApplication (BlastTheBloomingEmptyDocCreation) @end
@implementation NSApplication (BlastTheBloomingEmptyDocCreation)
-(void)_doOpenUntitled { }
@end
since the documented way of implementing the
applicationShouldHandleReopen:hasVisibleWindows: delegate method just does
not work :(((
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc