NSMenuItem setKeyEquivalentModifierMask not working as expected
NSMenuItem setKeyEquivalentModifierMask not working as expected
- Subject: NSMenuItem setKeyEquivalentModifierMask not working as expected
- From: David Kocher <email@hidden>
- Date: Sun, 30 Jan 2005 14:03:16 +0100
Hi all,
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).setKeyEquivalentModifierMas
k(NSEvent.CommandKeyMask);
this.protocolPopup.itemWithTitle(FTP_STRING).setKeyEquivalent("F");
this.protocolPopup.itemWithTitle(SFTP_STRING).setKeyEquivalentModifierMa
sk(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!
-dk
_______________________________________________
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