• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disabling menu items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabling menu items


  • Subject: Re: Disabling menu items
  • From: "McLaughlin, Michael P." <email@hidden>
  • Date: Fri, 15 May 2009 12:41:43 -0400
  • Acceptlanguage: en-US
  • Thread-topic: Disabling menu items

On 5/15/09 11:52 AM, "Mike Abdullah" <email@hidden> wrote:

> If you have no idea what the First Responder is, you are clearly out
> of your depth. Step back and read up on the Responder Chain. It is a
> very important concept and central to Cocoa.
>
> Mike Abdullah.
>

I know what a First Responder is, I just do not know, in this instance,
which object it is.  The debugger shows a call to openRecentDocument: in the
call chain and ascribes it to NSDocumentController (but marked as
"NSPrivate").  Hence, I tried using my override of NSDocumentController to
capture this menu event although I was aware that openRecentDocument: was
not in the corresponding API.

openRecentDocument: is so far the only method I have seen that comes close
to being what I was looking for.

I'm still looking.

> On 15 May 2009, at 16:01, McLaughlin, Michael P. wrote:
>
>> 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 (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
>
>


--
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

References: 
 >Re: Disabling menu items (From: Mike Abdullah <email@hidden>)

  • Prev by Date: -[NSScriptCommand suspendExecution]
  • Next by Date: Re: Unknown Host: Operation timed out Error
  • Previous by thread: Re: Disabling menu items
  • Next by thread: Re: Disabling menu items
  • Index(es):
    • Date
    • Thread