|Control properties / Secondary properties|
label is a secondary property, in that its value for a given control is not simply copied from a native property of that control. Moreover, instead of deriving its value from one or more native properties of its own control, it gets its value from a neighboring control.
The following image from a typical dialog box illustrates why TestArchitect obtains a control's label value from a neighbor:
At a glance, it's quite clear that the text to the left of the upper text box, Number of items, is descriptive of the value in that text box. However, that label belongs to an entirely different control, one of type textblock.
Clearly, the only thing connecting such controls is their proximity to each other. Hence, during a window intake, TestArchitect looks for all the controls of a window which normally appear with labels, but which rely on outside controls to provide them. It also surveys all the controls that typically serve as labels (for example, label controls in Java, or textblock controls in WPF). Then it employs an algorithm to pair up such controls.
A summary of the label-finding procedure follows. Details on some of the more technical definitions required for the algorithm's implementation are available in label property details.
In the matching process for every main (i.e., label-accepting) control, TestArchitect looks first for any label controls to the left or right of the main control, and whose top or bottom edges are aligned with it. It also looks for labels above the main control whose left edges are aligned with that of the main control. Labels that exceed some threshold distance from the main control are eliminated from contention. How alignment is defined is discussed in label property details.
If no labels are aligned, consideration is then given to labels that are to the left or above the main control, and again, not too distant from it.
Threshold distances vary by platform. How it is determined that a non-aligned label is acceptably positioned relative to a main control to be a candidate for label assignment is also discussed in label property details.
If a label-accepting control is not sufficiently close to a label control, its label property remains empty. The same is true if there are indeed one or more labels that are sufficiently close, but which are allocated to other controls that are more qualified. (An external label cannot be used by more than one control.)
Note that there is no guarantee that a TA label property of a
given control will be unique within a window. The label-finding algorithm does
guarantee that the same label control will not be used to provide a value for
more than one control. However,
if two label controls hold the same text, there is nothing to prevent them from
providing those texts to