Skip to content

Instantly share code, notes, and snippets.

@saikat
Created January 26, 2010 05:54
Show Gist options
  • Select an option

  • Save saikat/286589 to your computer and use it in GitHub Desktop.

Select an option

Save saikat/286589 to your computer and use it in GitHub Desktop.
- (void)keyDown:(CPEvent)anEvent
{
switch ([anEvent keyCode]) {
case CPReturnKeyCode:
[self addSelectedWidgetToScreen];
break;
case CPRightArrowKeyCode:
[self selectNextWidget];
break;
case CPLeftArrowKeyCode:
[self selectPreviousWidget];
break;
case CPUpArrowKeyCode:
[self selectWidgetAbove];
break;
case CPDownArrowKeyCode:
// TODO I have these comparisons to the dom event all over the place - this is a hack
// to keep firefox from sending a stale event - fix this - see
// my google groups post about it
[self selectWidgetBelow];
break;
default:
[[self nextResponder] keyDown:anEvent];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment