Skip to content

Commit

Permalink
NSTableView experimental changes to improve bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Aug 23, 2024
1 parent b003db2 commit 8e78ce6
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Source/NSTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -6842,15 +6842,24 @@ - (void) _setObjectValue: (id)value
NSString *keyPath = [tb _keyPathForValueBinding];
if (keyPath != nil)
{
NSArray *items = [[theBinding observedObject] arrangedObjects];
if (items != nil)
id array = [theBinding destinationValue];
id obj = [array objectAtIndex: index];
NSMutableArray *newArray = [NSMutableArray arrayWithArray: array];

NSLog(@"array = %@", array);
NSLog(@"array class = %@", [array class]);
NSLog(@"obj = %@", obj);
NSLog(@"class = %@", NSStringFromClass([obj class]));

[newArray replaceObjectAtIndex: index withObject: value];
[theBinding reverseSetValue: newArray];

// obj = value;
/*
if (obj != nil)
{
id obj = [items objectAtIndex: index];
if (obj != nil)
{
[obj setValue: value forKeyPath: keyPath];
}
}
[obj setValue: value forKeyPath: keyPath];
}*/
}
}
else if ([_dataSource respondsToSelector:
Expand Down

0 comments on commit 8e78ce6

Please sign in to comment.