In a Cocoa Document project (latest Xcode), I want to have only one document
open at a time.  I thought that I could do this by subclassing
NSDocumentController but I have been only partially successful.  For
instance, just as a test, the subclass code contains

-(BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)sender
{
   SEL a = [sender action];
   
   if (a == @selector(newDocument:))
      return NO;
   if (a == @selector(openRecentDocument:))
      return NO;
   
   return [super validateUserInterfaceItem:sender];
}

The disabling of newDocument: works but the second test fails.  It appears
that the subclass receives only newDocument: and openDocument: actions, not
openRecentDocument:

Moreover, IB says only that Open Recent goes to First Responder and I have
no idea what that First Responder is (else I might be able to subclass it).

There must be an easy way to do all of this.  Could someone point me to a
code example somewhere?  Or a good description?

TIA.

-- 
Mike McLaughlin

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to