Share via


UI Automation Events Overview

Microsoft UI Automation event notification is a key feature for assistive technologies, such as screen readers and screen magnifiers. These UI Automation clients track events that are raised by UI Automation providers when something happens in the user interface (UI) and use the information to notify end users.

Efficiency is improved by allowing provider applications to raise events selectively, depending on whether any clients are subscribed to those events, or not at all, if no clients are listening for any events.

UI Automation events fall into the following categories.

Event Description
Property change Raised when a property on UI Automation element or control pattern changes. For example, if a client needs to monitor an application check box control, it can register to listen for a property change event on the IUIAutomationTogglePattern::CurrentToggleState property. When the check box control is checked or unchecked, the provider raises the event and the client can act as necessary.
Element action Raised when a change in the UI results from end user or programmatic activity, for example, when a button is clicked or invoked through IUIAutomationInvokePattern.
Structure change Raised when the structure of the UI Automation tree changes. The structure changes when new UI items become visible, hidden, or removed on the desktop.
Global desktop change Raised when actions of global interest to the client occur, such as when the focus shifts from one element to another, or when a window closes.

Some events do not necessarily mean that the state of the UI has changed. For example, if the user tabs to a text entry field, and then clicks a button to update the field, a TextChangedEvent is raised, even if the user did not actually change the text. When processing an event, it may be necessary for a client application to check whether anything has actually changed before taking action.

The following events may be raised even when the state of the UI has not changed.

  • UIA_AutomationPropertyChangedEventId (depending on the property that has changed)
  • UIA_SelectionItem_ElementSelectedEventId
  • UIA_Selection_InvalidatedEventId
  • UIA_Text_TextChangedEventId

For a description of all UI Automation events, see Event Identifiers.