I have a custom NSTableView subclass that draws a few extra rows under the data rows. For example, one of these extra rows shows the sum of the numeric values in the data rows. I would like to make the extra rows available through the accessibility API.
In my custom table, I introduced a new accessibility attribute AXExtraRows, but Accessibility Inspector shows "<nil>" for AXExtraRows.
So I ran some experiments, and here's what I see in Accessibility Inspector:
- If I return an empty NSArray, I see an empty collection.
- If I return an NSArray of NSNumber objects, I see a collection of numbers.
- If I return any subset of objects for the attribute NSAccessibilityRowsAttribute, I see the returned subset of rows.
- But if I return an array of objects of my own class, I see "<nil>".
Why Accessibility Inspector is showing nil instead of the collection of the objects I return in the code? The extra row objects present themselves as AXRow:AXTableRow.
Here's the custom table code:
- (NSArray*)accessibilityAttributeNames
{
return [[super accessibilityAttributeNames] arrayByAddingObject:@"AXExtraRows"];
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
if ([attribute isEqualToString:@"AXExtraRows"])
{
return extraRows;
}
return [super accessibilityAttributeValue:attribute];
}
Thanks for any help.
/Dado