mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 10:01:14 +00:00
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:
parent
060b27a854
commit
aa86a96c55
2 changed files with 17 additions and 4 deletions
|
@ -1892,7 +1892,7 @@ Also returns the child index relative to this parent. */
|
|||
if (info != nil)
|
||||
{
|
||||
id theItem = [_items objectAtIndex: index];
|
||||
NSString *ikp = [info objectForKey: @"NSObservedKeyPath"];
|
||||
NSString *ikp = [info objectForKey: NSObservedKeyPathKey];
|
||||
NSUInteger location = [ikp rangeOfString: @"."].location;
|
||||
NSString *keyPath = (location == NSNotFound ? ikp : [ikp substringFromIndex: location + 1]);
|
||||
|
||||
|
@ -1927,7 +1927,7 @@ Also returns the child index relative to this parent. */
|
|||
if (info != nil)
|
||||
{
|
||||
id theItem = [_items objectAtIndex: index];
|
||||
NSString *ikp = [info objectForKey: @"NSObservedKeyPath"];
|
||||
NSString *ikp = [info objectForKey: NSObservedKeyPathKey];
|
||||
NSUInteger location = [ikp rangeOfString: @"."].location;
|
||||
NSString *keyPath = (location == NSNotFound ? ikp : [ikp substringFromIndex: location + 1]);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue