Fixed: CPDatePicker in a CPTableView wrong behavior

Previously, when clicking on a CPDatePicker in a CPTableView, cappuccino didn't select the tableView row firstly.
Now it does as in cocoa.
The stepper still have the same behavior as a CPButton in a CPTableView.

refs #2201
This commit is contained in:
Alexandre Wilhelm committed 2014-09-05 16:16:46 -07:00
1 parent 7052ce9e63
commit c1e89bd1c3
1 file changed
+17 -2
+17 -2
View File
@@ -533,9 +533,13 @@ var CPZeroKeyCode = 48,
#pragma mark -
#pragma mark Responder methods
/*! @ignore */
- (BOOL)acceptsFirstResponder
{
return NO;
// This is needed to accept to be firstResponder when nothing is selected.
// This element needs to be first responder when the CPDatePicker is in the CPTableView
// When clicking on a row of a CPTableView where there isn't a date element, the CPTableView will ask this element to know if it can becomes or not a firstResponder.
return [_datePicker isEnabled] && ![self superview]._currentTextField;
}
@@ -1282,6 +1286,12 @@ var CPMonthDateType = 0,
return self;
}
/*! @ignore */
- (BOOL)acceptsFirstResponder
{
return [_datePicker isEnabled];
}
/*! Set the dateType of the textField
*/
- (void)setDateType:(int)aDateType
@@ -1734,4 +1744,9 @@ var CPMonthDateType = 0,
return frameSize;
}
@end
- (CGRect)bezelRectForBounds:(CGRect)bounds
{
return CGRectMakeCopy(bounds);
}
@end