Update to use NSObservedKeyPathKey instead of string, add code to _setObjectValue:... in NSTableView to set the value when we have a binding

This commit is contained in:
Gregory John Casamento 2024-07-10 06:31:55 -04:00
parent 060b27a854
commit aa86a96c55
2 changed files with 17 additions and 4 deletions

View file

@ -6883,8 +6883,21 @@ For a more detailed explanation, -setSortDescriptors:. */
forTableColumn: (NSTableColumn *)tb
row: (NSInteger) index
{
if ([_dataSource respondsToSelector:
@selector(tableView:setObjectValue:forTableColumn:row:)])
GSKeyValueBinding *theBinding;
theBinding = [GSKeyValueBinding getBinding: NSValueBinding
forObject: tb];
if (theBinding != nil)
{
NSDictionary *info = [GSKeyValueBinding infoForBinding: NSValueBinding
forObject: tb];
id obj = [(NSArray *)[theBinding destinationValue]
objectAtIndex: index];
NSString *keyPath = [info objectForKey: NSObservedKeyPathKey];
[obj setValue: value forKeyPath: keyPath];
}
else if ([_dataSource respondsToSelector:
@selector(tableView:setObjectValue:forTableColumn:row:)])
{
[_dataSource tableView: self
setObjectValue: value