IUIAutomationEventHandlerGroup::AddActiveTextPositionChangedEventHandler method (uiautomationclient.h)
Registers a method (in an event handler group) that handles when the active text position changes.
Syntax
HRESULT AddActiveTextPositionChangedEventHandler(
[in] TreeScope scope,
[in] IUIAutomationCacheRequest *cacheRequest,
[in] IUIAutomationActiveTextPositionChangedEventHandler *handler
);
Parameters
[in] scope
The scope of events to be handled; that is, whether they are on the element itself, or on its ancestors and descendants.
[in] cacheRequest
A pointer to a cache request, or NULL if no caching is wanted.
[in] handler
A pointer to the object that handles the active text position changed event.
Return value
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
Before implementing an event handler, you should be familiar with the threading issues described in Understanding Threading Issues.
Active text position is indicated by a navigation event within or between read-only text elements (such as web browsers, Portable Document Format (PDF) documents, or EPUB documents) using bookmarks (or fragment identifiers to refer to a location within a resource). Examples include:
- Navigating to a bookmark within the same web page
- Navigating to a bookmark on a different web page
- Activating a link to a different location within the same PDF
- Activating a link to a different location within the same EPUB
For example, when a same page anchor (<a href=”#C4”>Jump to Chapter 4</a> ... <h1><a name="C4">Chapter 4</a></h1>
)
is invoked, the visual location is updated, but the UI Automation client remains at the original location. This results in actions such as text reading or move next item commands starting from the original location, not the new location.
Similarly, activating a new page URI (with a fragment identifier: (<a href=”www.blah.com#C4”>Jump to Chapter 4</a>
)) loads the new page and jumps to the specified bookmark, but leaves the UI Automation clients at the top of the page.
For editable text elements, such as Edit and Rich Edit controls, you can listen for a SelectionChanged event.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 10, version 1809 [desktop apps only] |
Minimum supported server | Windows Server, version 1709 [desktop apps only] |
Target Platform | Windows |
Header | uiautomationclient.h (include UIAutomation.h) |