aboutsummaryrefslogtreecommitdiffstats
path: root/CopyMailto/Base.lproj
diff options
context:
space:
mode:
authorTeddy Wing2018-09-05 23:10:18 +0200
committerTeddy Wing2018-09-05 23:10:18 +0200
commitb44d11312c8dd908a8e6d3c83e8f9773a893e15c (patch)
treef0888902dfeeacbb161e86b80dcdc9d4e99c5e15 /CopyMailto/Base.lproj
parente9da806f26bd6a9b11aa461a3093346967ccaf52 (diff)
downloadCopy-Mailto-b44d11312c8dd908a8e6d3c83e8f9773a893e15c.tar.bz2
Make "Quit" button work on "q" or "Escape" key press
Previously I only had a key equivalent on the "Escape" key because you can only set a single key equivalent. But I wanted the "Quit" button to work on both "Escape" and "q" presses. I tried to do this by overriding `performKeyEquivalent:`: - (BOOL)performKeyEquivalent:(NSEvent *)theEvent { if ([[theEvent characters] isEqualToString:@"q"] || [theEvent keyCode] == kVK_Escape) { NSLog(@"%@", theEvent); return YES; } return [super performKeyEquivalent:theEvent]; } The method was called and it logged correctly, but the `IBAction` wouldn't run. Maybe this doesn't work for what I want it to? Can't figure out what the problem is. Didn't want to deal any more so just overrode `keyDown:` instead and got rid of the `IBAction`, just terminating the application in code.
Diffstat (limited to 'CopyMailto/Base.lproj')
-rw-r--r--CopyMailto/Base.lproj/MainMenu.xib8
1 files changed, 1 insertions, 7 deletions
diff --git a/CopyMailto/Base.lproj/MainMenu.xib b/CopyMailto/Base.lproj/MainMenu.xib
index 9fd9f26..8b9ca42 100644
--- a/CopyMailto/Base.lproj/MainMenu.xib
+++ b/CopyMailto/Base.lproj/MainMenu.xib
@@ -107,19 +107,13 @@ DQ
<action selector="copyEmailToClipboard:" target="Voe-Tx-rLC" id="uX1-7A-IwJ"/>
</connections>
</button>
- <button verticalHuggingPriority="750" misplaced="YES" id="dF9-KQ-ymU">
+ <button verticalHuggingPriority="750" misplaced="YES" id="dF9-KQ-ymU" customClass="QuitButton">
<rect key="frame" x="328" y="13" width="66" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="push" title="Quit" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="aJz-qw-lxS">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
- <string key="keyEquivalent" base64-UTF8="YES">
-Gw
-</string>
</buttonCell>
- <connections>
- <action selector="terminate:" target="-1" id="M3t-iK-CjQ"/>
- </connections>
</button>
</subviews>
</view>