* Source/NSControl.m (-textDidChange:): If there is a binding with

continious update, pass on the changed text.
* Source/GSXibElement.m: Correct the handling of boolean values in attributes.
* Source/GSBindingHelpers.h,
* Source/NSKeyValueBinding.m: Prevent recursion when
reverseSetValue: is used.
* Source/NSTextField.m (-textDidChange:): Remove empty code line.
This commit is contained in:
Fred Kiefer 2021-03-27 21:20:28 +01:00
parent b8b4d7c2f0
commit 0576f2736b
6 changed files with 36 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2021-03-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSControl.m (-textDidChange:): If there is a binding with
continious update, pass on the changed text.
* Source/GSXibElement.m: Correct the handling of boolean values in attributes.
* Source/GSBindingHelpers.h,
* Source/NSKeyValueBinding.m: Prevent recursion when
reverseSetValue: is used.
* Source/NSTextField.m (-textDidChange:): Remove empty code line.
2021-03-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMenu.m (-_setOwnedByPopUp:): Only update the menu if

View file

@ -41,6 +41,7 @@
@public
NSDictionary *info;
id src;
BOOL inReverseSet;
}
+ (void) exposeBinding: (NSString *)binding forClass: (Class)clazz;

View file

@ -62,6 +62,10 @@
- (NSString*) value
{
if (value == nil)
{
return [attributes objectForKey: @"value"];
}
return value;
}

View file

@ -615,6 +615,7 @@ static NSNotificationCenter *nc;
- (void) textDidChange: (NSNotification *)aNotification
{
NSMutableDictionary *dict;
GSKeyValueBinding *theBinding;
dict = [[NSMutableDictionary alloc] initWithDictionary:
[aNotification userInfo]];
@ -624,6 +625,19 @@ static NSNotificationCenter *nc;
object: self
userInfo: dict];
RELEASE(dict);
theBinding = [GSKeyValueBinding getBinding: NSValueBinding
forObject: self];
if (theBinding != nil)
{
NSDictionary *options = [theBinding->info objectForKey: NSOptionsKey];
NSNumber *num = [options objectForKey: NSContinuouslyUpdatesValueBindingOption];
if ([num boolValue])
{
[theBinding reverseSetValueFor: @"objectValue"];
}
}
}
/**<p>Invokes when the text cell is changed.

View file

@ -361,7 +361,9 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
keyPath = [info objectForKey: NSObservedKeyPathKey];
dest = [info objectForKey: NSObservedObjectKey];
NSDebugLLog(@"NSBinding", @"reverseSetValue: keyPath %@, dest %@ value %@", keyPath, dest, value);
inReverseSet = YES;
[dest setValue: value forKeyPath: keyPath];
inReverseSet = NO;
}
- (void) reverseSetValueFor: (NSString *)binding
@ -378,6 +380,11 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
NSDictionary *options;
id newValue;
if (inReverseSet)
{
return;
}
if (change != nil)
{
options = [info objectForKey: NSOptionsKey];

View file

@ -536,7 +536,6 @@ static Class textFieldCellClass;
- (void) textDidChange: (NSNotification *)aNotification
{
NSFormatter *formatter;
[super textDidChange: aNotification];