Support for sendsActionOnEndEditing in CPControl. Only works for textfields right now.

This commit is contained in:
Ross Boucher
2009-10-28 00:12:03 -07:00
parent 22c248454e
commit ba84e6d3e2
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -94,7 +94,8 @@ var CPControlBlackColor = [CPColor blackColor];
id _target;
SEL _action;
int _sendActionOn;
BOOL _sendsActionOnEndEditing @accessors(property=sendsActionOnEndEditing);
// Mouse Tracking Support
BOOL _continuousTracking;
BOOL _trackingWasWithinFrame;
+5 -2
View File
@@ -269,8 +269,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
if (aDOMEvent && aDOMEvent.keyCode == CPReturnKeyCode)
{
[owner sendAction:[owner action] to:[owner target]];
[[owner window] makeFirstResponder:nil];
[owner sendAction:[owner action] to:[owner target]];
[owner selectText:nil];
}
else if (aDOMEvent && aDOMEvent.keyCode == CPTabKeyCode)
{
@@ -666,6 +666,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
//post CPControlTextDidEndEditingNotification
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
if ([self sendsActionOnEndEditing])
[self sendAction:[self action] to:[self target]];
return YES;
}