UI Automation Support for the Edit Control Type
This topic provides information about Microsoft UI Automation support for the Edit control type.
Edit controls enable a user to view and edit a simple line of text without rich formatting support.
The following sections define the required UI Automation tree structure, properties, control patterns, and events for the edit control type. The UI Automation requirements apply to the Edit control type, whether Microsoft Windows Presentation Foundation (WPF), Microsoft Win32, or Windows Forms.
This topic contains the following sections.
- Required UI Automation Tree Structure
- Required UI Automation Properties
- Required UI Automation Control Patterns
- Required UI Automation Events
- Remarks
- Related Topics
Required UI Automation Tree Structure
The following table depicts the control view and the content view of the UI Automation tree that pertains to edit controls and describes what can be contained in each view. For more information about the UI Automation tree, see UI Automation Tree Overview.
Control View | Content View |
---|---|
|
|
The controls that implement the Edit control type will always have zero scroll bars in the control view of the UI Automation tree because it is a single-line control. The single line of text may wrap in some layout scenarios. The Edit control type is only meant for small amounts of text.
Required UI Automation Properties
The following table lists the UI Automation properties whose value or definition is especially relevant to the edit controls. For more information about UI Automation properties, see UI Automation Properties for Clients.
UI Automation Property | Value | Notes |
---|---|---|
UIA_AutomationIdPropertyId | See notes. | The value of this property needs to be unique across all controls in an application. |
UIA_BoundingRectanglePropertyId | See notes. | The outermost rectangle that contains the whole control. |
UIA_ClickablePointPropertyId | See notes. | The edit control must have a clickable point that gives input focus to the edit portion of the control when a user clicks the mouse there. |
UIA_ControlTypePropertyId | Edit | This value is the same for all UI frameworks. |
UIA_IsContentElementPropertyId | TRUE | The edit control is always included in the content view of the UI Automation tree. |
UIA_IsControlElementPropertyId | TRUE | The edit control is always included in the control view of the UI Automation tree. |
UIA_IsKeyboardFocusablePropertyId | See notes. | If the control can receive keyboard focus, it must support this property. |
UIA_IsPasswordPropertyId | See notes. | Must be set to TRUE on edit controls that contain passwords. If an edit control does contain Password contents then this property can be used by a screen reader to determine whether keystrokes should be read out as the user types them. |
UIA_LabeledByPropertyId | See notes. | If there is a static text label associated with the control, this property must expose a reference to that control. If the text control is a subcomponent of another control, it will not have a LabeledBy property set. |
UIA_LocalizedControlTypePropertyId | See notes. | Localized string corresponding to the Edit control type. The default value is "edit" for en-US or English (United States). |
UIA_NamePropertyId | See notes. | The name of the edit control is typically generated from a static text label. If there is not a static text label, a property value for Name must be assigned by the application developer. The Name property should never contain the textual contents of the edit control. |
Required UI Automation Control Patterns
The following table lists the UI Automation control patterns required to be supported by edit controls. For more information on control patterns, see UI Automation Control Patterns Overview.
Control Pattern/Pattern Property | Support/Value | Notes |
---|---|---|
IRangeValueProvider | Depends | All edit controls that take a numeric range must expose the Range Value control pattern. |
IRangeValueProvider::Minimum | See notes. | This property must be the smallest value to which the contents of the edit control can be set. |
IRangeValueProvider::Maximum | See notes. | This property must be the largest value to which the contents of the edit control can be set. |
IRangeValueProvider::SmallChange | See notes. | This property must indicate the number of decimal places that the value can be set to. If the edit control only takes integers, the SmallChangeProperty must be 1. If the edit control takes a range from 1.0 to 2.0, then the SmallChangeProperty must be 0.1. If the edit control takes a range from 1.00 to 2.00 then the SmallChangeProperty must be 0.001. |
IRangeValueProvider::LargeChange | NULL | This property does not need to be exposed on an edit control. |
IRangeValueProvider::Value | See notes. | This property indicates the numeric contents of the edit control. When a more precise value is set by a UI Automation client within the ranges specified in the IRangeValueProvider::Minimum and IRangeValueProvider::Maximum properties, the IRangeValueProvider::Value property is automatically rounded to the closest accepted value. |
ITextProvider | Required | All edit controls should support the Text control pattern because detailed information should always be available for assistive technology clients. |
IValueProvider | Depends | All edit controls that take a string must expose the Value pattern. |
IValueProvider::IsReadOnly | See notes. | This property must be set to indicate whether the control can have a value set programmatically, or that can be edited by the user. |
IValueProvider::Value | See notes. | This property contains the textual contents of the edit control. If the UIA_IsPasswordPropertyId property is set to TRUE, querying the IValueProvider::Value property must return an error. |
Required UI Automation Events
The following table lists the UI Automation events that edit controls are required to support. For more information on events, see UI Automation Events Overview.
UI Automation Event | Support |
---|---|
UIA_AutomationFocusChangedEventId | None |
UIA_BoundingRectanglePropertyId property-changed event. | None |
UIA_IsEnabledPropertyId property-changed event. | If the control supports the IsEnabled property, it must support this event. |
UIA_IsOffscreenPropertyId property-changed event. | If the control supports the IsOffscreen property, it must support this event. |
UIA_NamePropertyId property-changed event. | None |
UIA_RangeValuePropertyId property-changed event. | If the control supports the Range control pattern, it must support this event. |
UIA_Selection_InvalidatedEventId | None |
UIA_ScrollHorizontallyScrollablePropertyId property-changed event. | An edit control never supports the Scroll control pattern. |
UIA_ScrollHorizontalScrollPercentId property-changed event. | An edit control never supports the Scroll control pattern. |
UIA_ScrollHorizontalViewSizePropertyId property-changed event. | An edit control never supports the Scroll control pattern. |
UIA_ScrollVerticallyScrollablePropertyId property-changed event. | An edit control never supports the Scroll control pattern. |
UIA_ScrollVerticalScrollPercentId property-changed event. | An edit control never supports the Scroll control pattern. |
UIA_ScrollVerticalViewSizePropertyId property-changed event. | An edit control never supports the Scroll control pattern. |
UIA_StructureChangedEventId | None |
UIA_Text_TextChangedEventId | None |
UIA_Text_TextSelectionChangedEventId | None |
UIA_ValueValuePropertyId property-changed event. | If the control supports the Value control pattern, it must support this event. |
Remarks
An edit control can be used as a read-only text field that does not support the selection or editing of text. Such an edit control behaves as a field object that has a specific name and value.
If an edit control contains placeholder text (for example, a cue banner), the text should be used as the HelpText property unless the text can be edited by the user and then reused as placeholder text. For example, the Windows Internet Explorer address bar contains the text "about:Tabs" when a new tab is opened. This is not HelpText because it is a programmatic address that can be used or edited by the user.