Permalink
Browse files

added focus for the buttons via space and enter keys

  • Loading branch information...
1 parent fe3f5e5 commit a49ba3413873d55fc550b70e70bc6bcf8ba5f80e @nikhgupta committed Feb 7, 2014
View
@@ -29,6 +29,9 @@ - (IBAction)start:(id)sender {
// and, make sure that that button says 'Pause'
[self.stopButton setNextState];
+ [self.stopButton setKeyEquivalent:@"\r"];
+ // space bar should not fire any button
+ [self.window makeFirstResponder:nil];
}
- (IBAction)pauseOrResume:(id)sender {
@@ -38,11 +41,15 @@ - (IBAction)pauseOrResume:(id)sender {
self.timer = nil;
// and, enable the start button.
[self.startButton setEnabled:YES];
+ // make start button as the first responder
+ [self.window makeFirstResponder:self.startButton];
} else {
// when the user clicks resume, we resume the watch
[self startTimer :[self.labelField doubleValue]];
// and, disable the start button.
[self.startButton setEnabled:NO];
+ // make start button as the first responder
+ [self.window makeFirstResponder:nil];
}
}

0 comments on commit a49ba34

Please sign in to comment.