• 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
First Responder (was "Re: Enable the Copy Menu")
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

First Responder (was "Re: Enable the Copy Menu")


  • Subject: First Responder (was "Re: Enable the Copy Menu")
  • From: Lorenzo <email@hidden>
  • Date: Tue, 02 Sep 2003 10:45:21 +0200

Hi,
I already implemented copy: and validateMenuItem: but it didn't work.
Anyway, thanks to you (you wrote "responder") I found the origin of the
problem. I forgot to add the "first responder" to the object that I create
programmatically and add to a mainView... So, now I do:

[mainView addSubview:myObject];
[[mainView window] makeFirstResponder:myObject];

Now, since there is a NSTextField in my Window too, I would like to select
my object typing the TAB key. So any time I type the TAB key, the selection
switches from the NSTextField to myObject, then to the NSTextField again.
Do you know ho to get this work?

Should I use one of this APIs?
- (BOOL)resignFirstResponder
- (BOOL)becomeFirstResponder
- (BOOL)acceptsFirstResponder

Thank you so much.


Best Regards
--
Lorenzo
email: email@hidden

>> Hi,
>> I can programmatically enable/disable the other menu items but not the
>> "Copy" Menu. I noted that the "Edit" menu has the flag "Auto Enabled
>> Items"
>> on.
>> If I deactivated this check-box I can programmatically enable/disable
>> the
>> "Copy" menu, but this way I loose the nice "auto enabling" feature on
>> the
>> text selections.
>>
>>
>> Do you know how to let my object enable/disable the "Copy" menu without
>> loosing the "auto enabling" feature?
>> Thank you.
>>
>>
>>
>
> Using autoenabling, Cocoa searches the responder chain for objects that
> respond to the action associated with the menu item. If you look at the
> Copy menu item, its action message is copy:, so add that action to your
> object and it should be enabled. You can also create a
> validateMenuItem: method in your object, where you can then
> enable/disable that menu item based on the context of your object, like
> if nothing is selected, you can disable the Copy menu item. Using
> validateMenuItem: allows you to override autoenabling.
>
> Don
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: First Responder (was "Re: Enable the Copy Menu")
      • From: Neil Earnshaw <email@hidden>
  • Prev by Date: Menu items validation woes...
  • Next by Date: Launch Arguments in PB
  • Previous by thread: Re: Menu items validation woes...
  • Next by thread: Re: First Responder (was "Re: Enable the Copy Menu")
  • Index(es):
    • Date
    • Thread