CPTextField should not bother with handling tab to go to the next key

view, CPWindow does that for us.
This commit is contained in:
Andreas Falk committed 2010-11-15 19:44:02 +01:00
1 parent bb9e1a830d
commit a302fdfb8f
1 file changed
+8 -38
+8 -38
View File
@@ -674,15 +674,15 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
{
if ([anEvent _couldBeKeyEquivalent] && [self performKeyEquivalent:anEvent])
return;
// CPTextField uses an HTML input element to take the input so we need to
// CPTextField uses an HTML input element to take the input so we need to
// propagate the dom event so the element is updated. This has to be done
// before interpretKeyEvents: though so individual commands have a chance
// to override this (tab to go to the next keyView and such).
// to override this (escape to clear the text in a search field for example).
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
[self interpretKeyEvents:[anEvent]];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
@@ -711,14 +711,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[self sendAction:[self action] to:[self target]];
[self selectText:nil];
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
}
- (void)insertNewlineIgnoringFieldEditor:(id)sender
{
var oldValue = [self stringValue];
[self _inputElement].value += CPNewlineCharacter;
[self _setStringValue:[self _inputElement].value];
@@ -734,35 +734,10 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
}
}
- (void)selectNextKeyView:(id)sender
{
[[self window] selectNextKeyView:self];
if ([[[self window] firstResponder] respondsToSelector:@selector(selectText:)])
[[[self window] firstResponder] selectText:self];
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
}
- (void)selectPreviousKeyView:(id)sender
{
[[self window] selectPreviousKeyView:self];
if ([[[self window] firstResponder] respondsToSelector:@selector(selectText:)])
[[[self window] firstResponder] selectText:self];
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
}
- (void)insertTab:(id)sender
{
[self selectNextKeyView:sender];
}
- (void)insertTabIgnoringFieldEditor:(id)sender
{
var oldValue = [self stringValue];
[self _inputElement].value += CPTabCharacter;
[self _setStringValue:[self _inputElement].value];
@@ -778,11 +753,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
}
}
- (void)insertBacktab:(id)sender
{
[self selectPreviousKeyView:sender];
}
- (void)textDidBlur:(CPNotification)note
{
// this looks to prevent false propagation of notifications for other objects