Browse files

Move by Keyboard

  • Loading branch information...
1 parent 27baf36 commit 272f668808cd4a6945e79c512abfc083e4b80412 @pppoe committed Sep 2, 2011
Showing with 30 additions and 0 deletions.
  1. +30 −0 GetFrame/GetFrameWinController.m
View
30 GetFrame/GetFrameWinController.m
@@ -183,6 +183,36 @@ - (void)selectionMoved {
[self updateFieldContent];
}
+- (void)keyDown:(NSEvent *)theEvent {
+ if (![_selectionView isHidden] && !_isSelecting)
+ {
+ if ([[theEvent characters] length] > 0)
+ {
+ unichar c = [[theEvent characters] characterAtIndex:0];
+ NSPoint org = [_selectionView frame].origin;
+ switch (c) {
+ case NSLeftArrowFunctionKey:
+ org.x--;
+ break;
+ case NSRightArrowFunctionKey:
+ org.x++;
+ break;
+ case NSUpArrowFunctionKey:
+ org.y++;
+ break;
+ case NSDownArrowFunctionKey:
+ org.y--;
+ break;
+ default:
+ break;
+ }
+ [_selectionView setFrameOrigin:org];
+ [self selectionMoved];
+ [self updateFieldContent];
+ }
+ }
+}
+
@end
@implementation GetFrameWinController (Private)

0 comments on commit 272f668

Please sign in to comment.