Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hitting enter opens the selected row in the results table view.

However, hitting enter anywhere in the window tries to open the selected row, which I think is a bug personally. It should click the "Search" button unless the results table is the first responder.
  • Loading branch information...
commit 46210e9ed6828751dc1bb7505b6b0f4227e59e79 1 parent 2b298c7
@caius authored
View
22 English.lproj/JPAckWindow.xib
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="3"/>
+ <integer value="4"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1342,6 +1342,14 @@
</object>
<int key="connectionID">143</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">resultsView</string>
+ <reference key="source" ref="878180471"/>
+ <reference key="destination" ref="919870025"/>
+ </object>
+ <int key="connectionID">147</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1793,9 +1801,9 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{253, 255}, {600, 600}}</string>
+ <string>{{252, 357}, {600, 600}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{253, 255}, {600, 600}}</string>
+ <string>{{252, 357}, {600, 600}}</string>
<boolean value="NO"/>
<string>{{33, 99}, {480, 360}}</string>
<integer value="1"/>
@@ -1837,7 +1845,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">143</int>
+ <int key="maxID">147</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1922,6 +1930,10 @@
<object class="IBPartialClassDescription">
<string key="className">JPAckSearchButton</string>
<string key="superclassName">NSButton</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">resultsView</string>
+ <string key="NS.object.0">NSScrollView</string>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">source/views/JPAckSearchButton.h</string>
@@ -2553,7 +2565,7 @@
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../../../../tmp/AckMate/AckMate.xcodeproj</string>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../AckMate.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">NSSwitch</string>
View
20 source/views/JPAckResultTableView.m
@@ -90,15 +90,17 @@ - (NSInteger)spanningColumnForRow:(NSInteger)rowIndex
return NSNotFound;
}
-// // Don't like this - removing it for now. Perhaps spacebar is a better activation trigger
-// - (void)keyDown:(NSEvent *)event
-// {
-// unichar u = [[event charactersIgnoringModifiers] characterAtIndex: 0];
-// if ((u == NSEnterCharacter || u == NSCarriageReturnCharacter) && [self activateRow:[self selectedRow]])
-// return;
-// else
-// [super keyDown:event];
-// }
+- (void)keyDown:(NSEvent *)event
+{
+ // Respond to the enter key to take action on the selected row
+ unichar u = [[event charactersIgnoringModifiers] characterAtIndex: 0];
+ if (u == NSEnterCharacter) {
+ [self activateRow:[self selectedRow] atPoint:NSMakePoint(0, 0)];
+ return;
+ }
+
+ [super keyDown:event];
+}
- (NSRect)frameOfCellAtColumn:(NSInteger)columnIndex row:(NSInteger)rowIndex
{
View
6 source/views/JPAckSearchButton.h
@@ -3,8 +3,12 @@
#import <Cocoa/Cocoa.h>
-@interface JPAckSearchButton : NSButton {
+@class JPAckResultTableView;
+@interface JPAckSearchButton : NSButton {
+ JPAckResultTableView *_resultsView;
}
+@property (nonatomic, retain) IBOutlet JPAckResultTableView *resultsView;
+
@end
View
8 source/views/JPAckSearchButton.m
@@ -5,6 +5,8 @@
@implementation JPAckSearchButton
+@synthesize resultsView = _resultsView;
+
- (BOOL)performKeyEquivalent:(NSEvent*)event
{
if ([[event charactersIgnoringModifiers] isEqualToString:[self keyEquivalent]] && ([event modifierFlags] & NSCommandKeyMask))
@@ -13,6 +15,12 @@ - (BOOL)performKeyEquivalent:(NSEvent*)event
return YES;
}
+ // If the enter key was pressed, we want the table view to respond to that, so send it along
+ if ([[event charactersIgnoringModifiers] characterAtIndex: 0] == NSEnterCharacter) {
+ [self.resultsView keyDown:event];
+ return NO;
+ }
+
return [super performKeyEquivalent:event];
}
Please sign in to comment.
Something went wrong with that request. Please try again.