Files
cappuccino/Tests/Manual/CPTextFieldMovementsTest/CustomTextField.j
T
Alexandre Wilhelm ebc1025fd9 New: Added Movement Codes for CPTextDidEndEditingNotification
This PR adds a new feature for CPControl. Now when leaving the control, the userInfo of the notification CPTextDidEndEditingNotification contains the last movements of the control as in COCOA

Test app in Tests/Manual/CPTextFieldMovementsTest
2013-10-29 01:20:00 -07:00

47 lines
875 B
Plaintext

/*
* CustomTextField.j
* CPTextFieldMovementsTest
*
* Created by Alexandre Wilhelm on October 29, 2013.
*/
@import <Foundation/Foundation.j>
@import <AppKit/CPTextField.j>
@implementation CustomTextField : CPTextField
{
}
- (id)init
{
if (self = [super init])
{
}
return self;
}
- (void)keyDown:(CPEvent)anEvent
{
var key = [anEvent charactersIgnoringModifiers];
if (key == CPLeftArrowFunctionKey)
{
[[self window] makeFirstResponder:[self previousKeyView]];
return;
}
if (key == CPRightArrowFunctionKey ||
key == CPUpArrowFunctionKey ||
key == CPDownArrowFunctionKey ||
key == CPEscapeFunctionKey ||
[anEvent keyCode] == CPReturnKeyCode)
{
[[self window] makeFirstResponder:[self nextKeyView]];
return;
}
[super keyDown:anEvent];
}
@end