Re: What types to return in accessibilityAttributeValue?
Re: What types to return in accessibilityAttributeValue?
- Subject: Re: What types to return in accessibilityAttributeValue?
- From: Christiaan Hofman <email@hidden>
- Date: Sat, 17 Mar 2012 11:29:18 +0100
On Mar 17, 2012, at 11:10, Felipe Monteiro de Carvalho wrote:
> Hello,
>
> I am implementing accessibility for the Cocoa backend of a
> cross-platform framework and I understand that I just need to override
> some routines in my objects, for example:
>
> function accessibilityAttributeValue(attribute: NSString): id; override;
>
> But I have many doubts and I could not find answers in the documentation.
>
> 1-> In the docs for the accessibility protocol there is no place
> saying which types should I return for given parameters. For example:
> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/Reference/Reference.html
> NSAccessibilitySizeAttribute
> Should I return a NSSize? Any small examples?
>
There's much more detailed info in the Accessibility Roles and Attributes Reference. Though most value types should be obvious from the name, like NSSize wrapped in NSValue in this case.
> 2-> NSAccessibilityChildrenAttribute if my child objects are not NS
> controls at all, they are all from my own framework and essentially
> don't exist for Cocoa. Should I then create a NSObject, override the
> accessibility methods and return an array of NSObjects?
>
They should be accessibility UI element, i.e. objects conforming to the NSAccessibility protocol. If they are Cocoa objects, you can use those, just make sure you implement NSAccessibility. Otherwise you can create representative Cocoa wrappers for the children that implement NSAccessibility. Note that UI elements are compared using isEqual:, so they don't have to be uniquely defined (e.g. it could be a wrapper that wraps a parent object and an index, or a parent object and the real child 'object' of interest).
You may want to have a look at the various sample code projects.
> 3->NSAccessibilityChildrenAttribute I think that the inherited routine
> will already create an array, even if empty, correct? So it creates a
> NSArray or a NSMutableArray?
>
Always assume an object is immutable if it is not explicitly stated in the API that it is mutable.
> thanks,
> --
> Felipe Monteiro de Carvalho
Christiaan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden