Selecting Child Objects

Clients call the IAccessible::accSelect method to modify selection or keyboard focus among the children in an object. The SELFLAG values specified with the call define the operation to perform.

If IAccessible::accSelect is called with the SELFLAG_TAKEFOCUS flag on a child object that has an HWND, the flag takes effect only if the object's parent has the focus.

Performing Complex Selection Operations

The following describes which SELFLAG values to specify when calling IAccessible::accSelect to perform complex selection operations.

To simulate a click

  • SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION

To select a target item by simulating CTRL + click

  • SELFLAG_TAKEFOCUS | SELFLAG_ADDSELECTION

To cancel selection of a target item by simulating CTRL + click

  • SELFLAG_TAKEFOCUS | SELFLAG_REMOVESELECTION

To simulate SHIFT + click

  • SELFLAG_TAKEFOCUS | SELFLAG_EXTENDSELECTION

To select a range of objects and put focus on the last object

  1. Specify SELFLAG_TAKEFOCUS on the starting object to set the selection anchor.
  2. Call IAccessible::accSelect again and specify SELFLAG_EXTENDSELECTION | SELFLAG_TAKEFOCUS on the last object.

To deselect all objects

  1. Specify SELFLAG_TAKESELECTION on any object. This flag deselects all selected objects except the one just selected.
  2. Call IAccessible::accSelect again and specify SELFLAG_REMOVESELECTION on the remaining object.