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 all edit controls where the UI framework/platform integrates UI Automation support for control types and control patterns.

This topic contains the following sections.

Typical Tree Structure

The following table depicts a typical control and 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
  • Edit
  • Edit

 

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.

Relevant 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 Retrieving Properties from UI Automation Elements.

UI Automation Property Value Notes
UIA_AutomationIdPropertyId See notes. The value of this property must be unique among all peer elements in the raw view of the UI Automation tree.
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
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 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 RangeValue control pattern.
Minimum See notes. This property must be the smallest value to which the contents of the edit control can be set.
Maximum See notes. This property must be the largest value to which the contents of the edit control can be set.
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 SmallChange property value must be 1. If the edit control takes a range from 1.0 to 2.0, then the SmallChange property value must be 0.1. If the edit control takes a range from 1.00 to 2.00 then the SmallChange property value must be 0.001.
LargeChange NULL This property does not need to be exposed on an edit control.
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 Minimum and Maximum properties, the Value property is automatically rounded to the closest accepted value.
ITextProvider Required All edit controls must support the Text control pattern because detailed information must always be available for assistive technology clients.
IValueProvider Depends All edit controls that take a string must expose the Value control pattern.
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.
Value See notes. This property contains the textual contents of the edit control. If the UIA_IsPasswordPropertyId property is set to TRUE, querying the Value property must return an error.

 

Required 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 Notes
UIA_AutomationFocusChangedEventId
UIA_BoundingRectanglePropertyId property-changed event.
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.
UIA_RangeValueValuePropertyId property-changed event. If the control supports the RangeValue control pattern, it must support this event.
UIA_ScrollHorizontallyScrollablePropertyId property-changed event. An edit control never supports the Scroll control pattern.
UIA_ScrollHorizontalScrollPercentPropertyId 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_ScrollVerticalScrollPercentPropertyId 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
UIA_Text_TextChangedEventId If the control supports the Text control pattern, it must support this event.
UIA_Text_TextSelectionChangedEventId If the control supports the Text control pattern, it must support this event.
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.

Conceptual

UI Automation Control Types Overview

UI Automation Overview