Andy Balholm's NSCachingBinder changes

This commit is contained in:
Christopher Lloyd 2009-08-05 20:08:31 +00:00
parent f5748d47d1
commit 9cf7fc36f2
2 changed files with 8 additions and 2 deletions

View File

@ -16,6 +16,7 @@
{
id _cachedValue;
BOOL _bound;
BOOL _currentlyTransferring;
}
- (id)cachedValue;

View File

@ -55,8 +55,9 @@ static void * NSCachingBinderChangeContext = (void *)@"NSCachingBinderChangeCont
- (void)showValue:(id)newValue
{
if (![_cachedValue isEqual:newValue])
if (![_cachedValue isEqual:newValue] && !_currentlyTransferring)
{
_currentlyTransferring = YES;
[self setCachedValue:newValue];
BOOL editable=YES;
@ -90,15 +91,19 @@ static void * NSCachingBinderChangeContext = (void *)@"NSCachingBinderChangeCont
if(isPlaceholder && [_source respondsToSelector:@selector(_setCurrentValueIsPlaceholder:)])
[_source _setCurrentValueIsPlaceholder:YES];
_currentlyTransferring = NO;
}
}
- (void)applyValue:(id)newValue
{
if (![_cachedValue isEqual:newValue])
if (![_cachedValue isEqual:newValue] && !_currentlyTransferring)
{
_currentlyTransferring = YES;
[self setCachedValue:newValue];
[_destination setValue:newValue forKeyPath:_keyPath];
_currentlyTransferring = NO;
}
}