Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
- Subject: Re: NSMenuItem setKeyEquivalentModifierMask not working as expected
- From: j o a r <email@hidden>
- Date: Sun, 30 Jan 2005 14:36:23 +0100
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).setKeyEquivalentModifierMa
sk(NSEvent.CommandKeyMask);
this.protocolPopup.itemWithTitle(FTP_STRING).setKeyEquivalent("F");
this.protocolPopup.itemWithTitle(SFTP_STRING).setKeyEquivalentModifierM
ask(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!
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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