Upravit

Sdílet prostřednictvím


Spinner Control Type

This topic provides information about Microsoft UI Automation support for the Spinner control type.

Spinner controls are used to select from a domain of items or a range of numbers.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the Spinner control type. The UI Automation requirements apply to all spinner 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 pertain to spinner controls when they support the RangeValue and Selection control patterns and describes what can be contained in each view. For more information about the UI Automation tree, see UI Automation Tree Overview.

RangeValue control pattern

Control View Content View
  • Spinner
    • Edit (0 or 1)
    • Button (2)
  • Spinner

 

Selection control pattern

Control View Content View
  • Spinner
    • Edit (0 or 1)
    • Button (2)
    • List Item (0 or more)
  • Spinner
    • ListItem (0 or more)

 

To ensure that the two buttons in the control view subtree can be distinguished by automated test tools, assign the ScrollAmount_SmallIncrement or ScrollAmount_SmallDecrement value to the AutomationId property as appropriate. For some implementations, the associated edit control may be a peer of the spinner control.

Relevant Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to spinner 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 spinner control's clickable point gives focus to the edit portion of the control.
UIA_ControlTypePropertyId Spinner This value is the same for all frameworks.
UIA_IsContentElementPropertyId TRUE The spinner control must always be content.
UIA_IsControlElementPropertyId TRUE The spinner control must always be a control.
UIA_IsKeyboardFocusablePropertyId See notes. If the control can receive keyboard focus, it must support this property. A spinner control rarely takes the focus, but when it does, the focus should remain on the spinner control itself, not on the child buttons. The user should be able to perform all scrolling actions by using the UP ARROW and DOWN ARROW keys.
UIA_LabeledByPropertyId See notes. Spinner controls have a static text label.
UIA_LocalizedControlTypePropertyId See notes. Localized string corresponding to the Spinner control type. The default value is "spinner" for en-US or English (United States).
UIA_NamePropertyId See notes. The spinner control typically gets its name from a static text label.

 

Required Control Patterns

The following table lists the UI Automation control patterns required to be supported by all spinner controls. For more information on control patterns, see UI Automation Control Patterns Overview.

Control Pattern/Pattern Property Support/Value Notes
IRangeValueProvider Depends Spinner controls that span a numeric range can support the RangeValue control pattern.
ISelectionProvider Depends Spinner controls that have a list of items to be selected must support the Selection control pattern.
CanSelectMultiple FALSE Spinner controls are always single selection containers.
IValueProvider Depends Spinner controls that span a descrete set of options or numbers can support the Value control pattern.

 

Required Events

The following table lists the UI Automation events that spinner 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_RangeValueValuePropertyId property-changed event. If the control supports the RangeValue control pattern, it must support this event.
UIA_Selection_InvalidatedEventId property-changed event. If the control supports the Selection control pattern, it must support this event.
UIA_StructureChangedEventId
UIA_ValueValuePropertyId property-changed event. If the control supports the Value control pattern, it must support this event.

 

Conceptual

UI Automation Control Types Overview

UI Automation Overview