Re: How to use text and caret MSAA roles correctly.

Ian Reed

I've started playing with UIAutomation as well to see if that will give me better control over how NVDA perceives my controls.
I see that I am able to override some behavior, but that NVDA still detects either the underlying windows forms control or MSAA object, and uses things like the role and display text from them instead of the Value or ControlType I set in UIAutomation.

Is UIAutomation a better option than MSAA to give me more fine grained control over how NVDA perceives my controls?
Is there a simple way to get NVDA to prefer what I set in UIAutomation instead of using the window class or MSAA object?
Is there documentation I can read that outlines the best ways to communicate with NVDA through an accessibility model and how it decides what information to prefer?


On 4/5/2019 7:34 AM, Ian Reed via Groups.Io wrote:
I am implementing a custom textbox control using Windows Forms from the .NET Framework.
I see that I can create AccessibilityObjects that contain MSAA values such as Name, Role, Value, and a variety of states like focusable and selected.
These objects can have roles like text or caret, and can have children.
Can you tell me what a basic MSAA DOM should look like for a simple textbox that has a caret and some selected text?

I printed the hierarchy of AccessibilityObjects for a standard windows forms textbox, but it had no children and I did not see an object with the caret role.
I examined an existing Windows Forms textbox in the NVDA log viewer, which said:
DEBUG - editableText.EditableText._hasCaretMoved (06:40:57.660):
Caret move detected using bookmarks. Elapsed: 0 ms

I'm not sure what bookmarks are, but some other reading indicates that screen readers often just look for a blinking cursor to detect the caret. Is that what NVDA does?

How can I use the text and caret roles to get NVDA to understand the caret's current location, and to support selecting text?

Ian Reed

Join to automatically receive all group messages.