AccControl Tag

AccControl uses the IAccessible interface from MSAA. The tag has a name property to define the user-accessible (friendly) name for a control. You can find more information about the IAccessible object in the Accessibility Development Center on MSDN.

Note

Note: The Active Accessibility 2.0 SDK, which can be downloaded from MSDN, includes an AccExplorer tool that allows the user interface of an application to be interrogated for its IAccessible object tree.

It has a <Path> tag to define a search path for the control in the applications IAccessibility tree. The <Path> tag can contain the tags:

  • <Next>: For more information, see Next Tag.
  • <FindWindow>: For more information, see FindWindow Specification.

Note

Some elements have a <match> attribute that you can use to add a counter to the search description. The following examples give the same result, but the first example implements the <match> tag:
Example 1:
<Caption match=”2”>Test Application</Caption>
Example 2:
<Caption>Test Application</Caption>
<Caption>Test Application</Caption>
If match is not specified the default value is 0.

The following code snippet shows control definition using the <AccControl> tag:

<AccControl name="Control Name">
   <Path> 
      <FindWindow>
         <CaptionStartsWith>Customer App</CaptionStartsWith>
      </FindWindow>
      <Next/>
      <Next match="2">Customer Name:</Next>
   </Path>
</AccControl>

GetControlValue() on an AccControl will always be mapped to the get_accValue() method on the subject IAccessible node, unless the node contains role=“radio button” or role=“check box”. In these cases, GetControlValue() will return “true” or “false” depending on whether the state of the node is “checked” or not.

SetControlValue() on an AccControl will always be mapped to the set_accValue() method on the subject IAccessible node, with the exception of nodes that have role=“radio button” or role=”check box”. In the case of a radio button, an UnsupportedControlOperation exception will be raised because a radio button cannot be assigned a true or false value. Refer to the following example.

# RELAX NG XML grammar for Path
# http://relaxng.org/compact-tutorial-20030326.html
grammar 
{
start = Path
Path = element Path { 
FindWindow* & element Next 
{ attribute match { xsd:integer }?
,attribute offset { xsd:integer  }?                                                                                          ,text? }* 
}
}