How disable File/Open command -- SOLVED
How disable File/Open command -- SOLVED
- Subject: How disable File/Open command -- SOLVED
- From: "McLaughlin, Michael P." <email@hidden>
- Date: Mon, 15 Aug 2011 09:52:05 -0400
- Acceptlanguage: en-US
- Thread-topic: How disable File/Open command -- SOLVED
I managed to find this solution shortly after sending a request to this list for help. I show the code below so that future programmers might find this more easily that I did. This solution has not been tested with Lion. [Note: This app does not have a File/New command and does not open an untitled document.]
________________________________
1. Subclass NSDocumentController --> myDocController
2. Add the code below to myDocController
3. Connect File/Open menu command to myDocController's openDocument IBAction (in IB or Xcode 4).
- (IBAction)openDocument:(id)sender
{
[super openDocument:sender];
}
-(BOOL)validateMenuItem:(id)sender
{
BOOL ok = YES;
extern BOOL haveData;
if ([sender action] == @selector(openDocument:))
ok = (haveData == NO);
return ok;
}
--
Mike McLaughlin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden