Merge pull request #2164 from daboe01/fixed--CPTextField-&-Bindings--data-updates-even-though-no-editing-has-taken-place

Fixed: textField bindings delete data in case of multiple selection after tabbing out with no editing
This commit is contained in:
Antoine Mercadal committed 2014-11-17 12:49:15 -08:00
commit 1402133c32
1 file changed
+17
+17
View File
@@ -2065,6 +2065,23 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
[_source setObjectValue:aValue];
}
- (void)reverseSetValueFor:(CPString)aBinding
{
var destination = [_info objectForKey:CPObservedObjectKey],
keyPath = [_info objectForKey:CPObservedKeyPathKey],
options = [_info objectForKey:CPOptionsKey],
newValue = [self valueForBinding:aBinding],
value = [destination valueForKeyPath:keyPath];
if (CPIsControllerMarker(value) && newValue === nil) return;
newValue = [self reverseTransformValue:newValue withOptions:options];
[self suppressSpecificNotificationFromObject:destination keyPath:keyPath];
[destination setValue:newValue forKeyPath:keyPath];
[self unsuppressSpecificNotificationFromObject:destination keyPath:keyPath];
}
@end
@implementation _CPTextFieldPatternValueBinder : CPValueWithPatternBinding