-[NSMenuItem setKeyEquivalent] not working for some keys

  • the app i'm developing lets users specify the keyboard shortcuts to
    use for menu items. this has been working for several months now.
    however, i noticed yesterday that if i attempt to set a shortcut (via
    -[NSMenuItem setKeyEquivalent]) of command-1 / command-2 / command-3
    / command-4 it no longer "takes".

    while debugging, i've discovered the following: if i examine the menu
    item before and after calling setKeyEquivalent, i see the private
    iVar _keyEquivalent changing properly. however if i "po [menuItem
    keyEquivalent]" from the debugger console window the debugger prints
    out <object returned empty description> and the menu does not show
    the shortcut as being set. (note that i do also use
    setKeyEquivalentModifierMask to set the appropriate mask.)

    i can set shortcuts to other command-<X> (where X is anything but 1,
    2, 3, or 5) and if i set a shortcut to use modifier keys other than
    or in conjunction with the command key it also works. additonally, if
    i set menu item shortcuts in IB, it works fine for command 1-4/

    now i know (after many frustrating hours of various debugging and
    testing) that this has something to do with my user account, because
    if i login as a different user or boot from a different partition,
    the problem goes away. i also know that this is not related to any of
    my login startup items (as set in system prefs for my account)
    because if i remove all of them the problem persists.

    has anyone encountered anything like this before?

    can anyone suggest how i can find this problem? or point me to some
    documentation as to how to find the problem?

    thanx very much,
    ken
  • OS X offers the ability for you to set custom keyboard shortcuts for
    any menu in any app.  Perhaps something is overriding things?

    Mike.

    On 18 Oct 2006, at 21:22, Ken Victor wrote:

    > the app i'm developing lets users specify the keyboard shortcuts to
    > use for menu items. this has been working for several months now.
    > however, i noticed yesterday that if i attempt to set a shortcut
    > (via -[NSMenuItem setKeyEquivalent]) of command-1 / command-2 /
    > command-3 / command-4 it no longer "takes".
    >
    > while debugging, i've discovered the following: if i examine the
    > menu item before and after calling setKeyEquivalent, i see the
    > private iVar _keyEquivalent changing properly. however if i "po
    > [menuItem keyEquivalent]" from the debugger console window the
    > debugger prints out <object returned empty description> and the
    > menu does not show the shortcut as being set. (note that i do also
    > use setKeyEquivalentModifierMask to set the appropriate mask.)
    >
    > i can set shortcuts to other command-<X> (where X is anything but
    > 1, 2, 3, or 5) and if i set a shortcut to use modifier keys other
    > than or in conjunction with the command key it also works.
    > additonally, if i set menu item shortcuts in IB, it works fine for
    > command 1-4/
    >
    > now i know (after many frustrating hours of various debugging and
    > testing) that this has something to do with my user account,
    > because if i login as a different user or boot from a different
    > partition, the problem goes away. i also know that this is not
    > related to any of my login startup items (as set in system prefs
    > for my account) because if i remove all of them the problem persists.
    >
    > has anyone encountered anything like this before?
    >
    > can anyone suggest how i can find this problem? or point me to some
    > documentation as to how to find the problem?
    >
    > thanx very much,
    > ken
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/mike.abdullah%
    > 40gmail.com
    >
    > This email sent to <mike.abdullah...>
  • mike,
    thanx for the reply.

    i should have mentioned in my first email that i checked system prefs
    custom keyboard shortcuts and quickeys as one of my first
    explorations. also, i can set shortcuts of command 1-4 for xcode
    preferences. so its some combination of my user account and my app.

    ken

    At 11:46 AM +0100 10/19/06, Mike Abdullah wrote:
    > OS X offers the ability for you to set custom keyboard shortcuts for
    > any menu in any app.  Perhaps something is overriding things?
    >
    > Mike.
    >
    > On 18 Oct 2006, at 21:22, Ken Victor wrote:
    >
    >> the app i'm developing lets users specify the keyboard shortcuts to
    >> use for menu items. this has been working for several months now.
    >> however, i noticed yesterday that if i attempt to set a shortcut
    >> (via -[NSMenuItem setKeyEquivalent]) of command-1 / command-2 /
    >> command-3 / command-4 it no longer "takes".
    >>
    >> while debugging, i've discovered the following: if i examine the
    >> menu item before and after calling setKeyEquivalent, i see the
    >> private iVar _keyEquivalent changing properly. however if i "po
    >> [menuItem keyEquivalent]" from the debugger console window the
    >> debugger prints out <object returned empty description> and the
    >> menu does not show the shortcut as being set. (note that i do also
    >> use setKeyEquivalentModifierMask to set the appropriate mask.)
    >>
    >> i can set shortcuts to other command-<X> (where X is anything but
    >> 1, 2, 3, or 5) and if i set a shortcut to use modifier keys other
    >> than or in conjunction with the command key it also works.
    >> additonally, if i set menu item shortcuts in IB, it works fine for
    >> command 1-4/
    >>
    >> now i know (after many frustrating hours of various debugging and
    >> testing) that this has something to do with my user account,
    >> because if i login as a different user or boot from a different
    >> partition, the problem goes away. i also know that this is not
    >> related to any of my login startup items (as set in system prefs
    >> for my account) because if i remove all of them the problem
    >> persists.
    >>
    >> has anyone encountered anything like this before?
    >>
    >> can anyone suggest how i can find this problem? or point me to some
    >> documentation as to how to find the problem?
    >>
    >> thanx very much,
    >> ken
    >>
    >> _______________________________________________
    >> Do not post admin requests to the list. They will be ignored.
    >> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> http://lists.apple.com/mailman/options/cocoa-dev/<mike.abdullah...>
    >>
    >> This email sent to <mike.abdullah...>
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today