• 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: NSMenuItem setKeyEquivalentModifierMask not working as expected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMenuItem setKeyEquivalentModifierMask not working as expected


  • Subject: Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
  • From: David Kocher <email@hidden>
  • Date: Sun, 30 Jan 2005 14:53:00 +0100

That solves the problem. Many thanks!

Btw: Sometimes I am wondering about the API design; i.e. it would make more sense if it would be
setKeyEquivalent(char)
instead of
setKeyEquivalent(String)


and the problem I have described should result in a wrong key equivalent assigned but not influence the modifier key, should it?!

Anyway; thanks for the quick resolution of the problem.

-dk

On 30. Jan 2005, at 14:36, j o a r wrote:

What happens if you assign "f" instead of "F"?

j o a r

On 2005-01-30, at 14.03, David Kocher wrote:

Trying to assign a key equivalent to a menu item in a NSPopupButton doesn't seem to work; or at least not as I expect to work. Although I assign a modifier mask of NSEvent.CommandKeyMask; the menu items always have both the shift and command key modifier assigned.

This code

public void setProtocolPopup(NSPopUpButton protocolPopup) {
this.protocolPopup = protocolPopup;
this.protocolPopup.removeAllItems();
this.protocolPopup.addItemsWithTitles(new NSArray(new String[] {FTP_STRING, SFTP_STRING}));
this.protocolPopup.itemWithTitle(FTP_STRING).setKeyEquivalentModifierM ask(NSEvent.CommandKeyMask);
this.protocolPopup.itemWithTitle(FTP_STRING).setKeyEquivalent("F");
this.protocolPopup.itemWithTitle(SFTP_STRING).setKeyEquivalentModifier Mask(NSEvent.CommandKeyMask);
this.protocolPopup.itemWithTitle(SFTP_STRING).setKeyEquivalent("S");
this.protocolPopup.setTarget(this);
this.protocolPopup.setAction(new NSSelector("protocolSelectionDidChange", new Class[]{Object.class}));
}


will result in a popup button with the key equivalents
	<shift><command>F
	<shift><command>S

Thanks for any hints!

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >NSMenuItem setKeyEquivalentModifierMask not working as expected (From: David Kocher <email@hidden>)
 >Re: NSMenuItem setKeyEquivalentModifierMask not working as expected (From: j o a r <email@hidden>)

  • Prev by Date: Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
  • Next by Date: Getting <null> when I add: via NSArrayController
  • Previous by thread: Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
  • Next by thread: Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
  • Index(es):
    • Date
    • Thread