Fixed: token fields would sometimes unexpectedly steal first responder status.

If an autocomplete choice was made followed by immediately focusing on another control, the token field would reclaim first responder status a moment later.
This commit is contained in:
Alexander Ljungberg
2012-08-01 19:18:40 +01:00
parent 31ab70d6fc
commit 90ae5766e6
+8 -8
View File
@@ -65,7 +65,7 @@ var _CPAutocompleteMenuMaximumHeight = 307;
[scrollView setHasHorizontalScroller:NO];
[contentView addSubview:scrollView];
tableView = [[CPTableView alloc] initWithFrame:CPRectMakeZero()];
tableView = [[_CPNonFirstResponderTableView alloc] initWithFrame:CPRectMakeZero()];
var tableColumn = [CPTableColumn new];
[tableColumn setResizingMask:CPTableColumnAutoresizingMask];
@@ -251,14 +251,14 @@ var _CPAutocompleteMenuMaximumHeight = 307;
return [contentArray objectAtIndex:row];
}
- (void)tableViewSelectionDidChange:(CPNotification)notification
@end
@implementation _CPNonFirstResponderTableView : CPTableView
- (BOOL)acceptsFirstResponder
{
// FIXME
// make sure a mouse click in the tableview doesn't steal first responder state
window.setTimeout(function()
{
[[textField window] makeFirstResponder:textField];
}, 2.0);
return NO;
}
@end