diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 899c460b9..0b85ef76c 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -1957,6 +1957,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