Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Role descriptions for custom controls



Ricky,

In Cocoa, you can use 

NSString *NSAccessibilityRoleDescription(NSString *role, NSString *subrole);

You will find it, and a number of other helpful utility functions in NSAccessibility.h.

Another related function is NSString *NSAccessibilityActionDescription(NSString *action);

Also, you might find these functions useful for traversing the accessibility hierarchy:

APPKIT_EXTERN id NSAccessibilityUnignoredAncestor(id element);
APPKIT_EXTERN id NSAccessibilityUnignoredDescendant(id element);
APPKIT_EXTERN NSArray *NSAccessibilityUnignoredChildren(NSArray *originalChildren);
APPKIT_EXTERN NSArray *NSAccessibilityUnignoredChildrenForOnlyChild(id originalChild);


In cases where I have a UI object that has no Apple equivalent, I do know that I'd need to provide both the role and description (basically what the Clock Control example code does).

Wherever possible, please use existing roles, if the behavior of your UI object is the same or very similar to an existing element.  For instance, radio buttons, the segmented control, and the tabs of a tab view are all accessorized as AXRadioButton, since they all give the user the ability to select one choice of a number of items.

You might also want to take a look at the AXCanvas example in /Developer/Accessibility/AXCanvas.

I hope this helps.

-James



On Jul 3, 2006, at 10:54 AM, Ricky Sharp wrote:


On Monday, July 03, 2006, at 12:17PM, David Niemeijer <email@hidden> wrote:

1) You should be able to use the accessibility inspector to verify 
whether a proper role description is provided by the super class (I 
am not a Cocoa program so would not know).

Good point; I'll definitely check that tonight.

2) In Carbon, and perhaps also in Cocoa you can use
CFStringRef HICopyAccessibilityRoleDescription(CFStringRef inRole, 
CFStringRef inSubrole);
Given the role and subrole this should deliver a localized role 
description. There may be a Ccoa equivalent or because NSString and 
CFString are exchangeable you could probably use this carbon function.

Excellent.  Yes, CFString and NSString are toll-free-bridged.  Also, my Cocoa app already links to Carbon.framework for a few things, so not a problem if I need to use the HI APIs.

Thanks!

--
Rick Sharp
Instant Interactive(tm)

 _______________________________________________
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

--------------------------------------------------
James Dempsey
AppKit Engineering
Apple



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/accessibility-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.