• 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: setKeyEquivalent: gives two action invocations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setKeyEquivalent: gives two action invocations


  • Subject: Re: setKeyEquivalent: gives two action invocations
  • From: "Ken Ferry" <email@hidden>
  • Date: Thu, 22 Mar 2007 21:41:04 -0700

Hi Roland,

This is a bug.  Key equivalents with the function key mask set and
without the command key modifier are sent for both key up and key
down.

You can work around it in a future proof way with code like this:

- (IBAction)myAction:(id)sender {
   if ([[NSApp currentEvent] type] == NSKeyUp)
       return;
   ...


Ken Ferry Cocoa frameworks

On 3/22/07, Roland Torres <email@hidden> wrote:
I set a key equivalent for a NSButton like this:

     unichar arrowDownKey = NSDownArrowFunctionKey;
     [myButton setKeyEquivalent:[NSString
stringWithCharacters:&arrowDownKey length:1]];

When I press the down arrow key, it invokes the action associated
with pressing the button *twice* (ie, my method gets called twice in
a row). This occurs no matter which function key equiv I use (except
the Help key), not just the arrow keys.

What am I doing wrong? Is there a way to set this in IB instead?
(Cocoa, OSX 10.4.9)

Roland

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: setKeyEquivalent: gives two action invocations
      • From: Roland Torres <email@hidden>
References: 
 >setKeyEquivalent: gives two action invocations (From: Roland Torres <email@hidden>)

  • Prev by Date: Re: filteredArrayUsingPredicate - need help with run time error
  • Next by Date: Re: NSData dataWithBytes problem on Intel
  • Previous by thread: setKeyEquivalent: gives two action invocations
  • Next by thread: Re: setKeyEquivalent: gives two action invocations
  • Index(es):
    • Date
    • Thread