Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IAccessible::accSelect method

The IAccessible::accSelect method modifies the selection or moves the keyboard focus of the specified object. All objects that support selection or receive the keyboard focus must support this method.

Syntax


HRESULT accSelect(
  [in]  long flagsSelect,
  [in]  VARIANT varID
);

Parameters

flagsSelect [in]

Type: long

Specifies which selection or focus operations are to be performed. This parameter must have a combination of the SELFLAG Constants.

varID [in]

Type: VARIANT

Specifies the selected object. If the value is CHILDID_SELF, the object itself is selected; if a child ID, one of the object's child elements is selected. For more information about initializing the VARIANT structure, see How Child IDs Are Used in Parameters.

Return value

Type: HRESULT

If successful, returns S_OK.

If not successful, returns one of the values in the table that follows, or another standard COM error code.

ErrorDescription
S_FALSE

The specified object is not selected.

E_INVALIDARG

An argument is not valid. This return value means that the specified SELFLAG combination is not valid, or that the SELFLAG value does not make sense for the specified object. For example, the following flags are not allowed on a single-selection list box: SELFLAG_EXTENDSELECTION, SELFLAG_ADDSELECTION, and SELFLAG_REMOVESELECTION.

DISP_E_MEMBERNOTFOUND

The object does not support this method.

 

Remarks

Client applications use this method to perform complex selection operations. For more information, see Selecting Child Objects. This method provides the simplest way to programmatically switch the input focus between applications. This applies to applications running on Windows 2000.

Note:   This method is for the selection of items, not text.

Client Example

The following example function selects the item at a specified point on the screen. It is assumed that a single selection is wanted.



HRESULT SelectItemAtPoint(POINT point)
{
    VARIANT varItem;
    IAccessible* pAcc;
    HRESULT hr = AccessibleObjectFromPoint(point, &pAcc, &varItem);
    if ((hr == S_OK))
    {
        hr = pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varItem);
        VariantClear(&varItem);
        pAcc->Release();
    }
    return hr;
}


Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Redistributable

Active Accessibility 1.3 RDK on Windows NT 4.0 with SP6 and later and Windows 95

Header

Oleacc.h

Library

Oleacc.lib

DLL

Oleacc.dll

See also

IAccessible
SELFLAG
VARIANT
Selection and Focus Properties and Methods
IAccessible::get_accFocus
IAccessible::get_accSelection

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.