...
In this case the box is an input box, and the user can start typing a search term there. What field(s) are being used to find the record is defined by the quicksearch parameters of the control. The control starts to do a search as soon as one or more letters are being typed and there is a small pause in input (or 250 ms have passed and no search has been done yet). If the user continues to type the control will do multiple searches so that the result will most closely represent whatever is typed by the user.
In this state the "clear" button is disabled, even when there is some "partial result" substate (see below).
Depending on the result of the search we have the following "substates" for the control:
...
If typing leads to exactly one match then that match is immediarely immediately selected as soon as the search returns, and the display changes to "Value State".
Common rules for all of the "input" formats
Both input formats should have exactly the same horizontal and vertical size.
The baselines of any texts inside either input or "no selection" value must match the baseline of any label before it inside a form.
Value Display state
When the control is "filled in" it shows the selected value. The display of that selected value can vary greatly as it can be heavily customized by using a custom renderer. But the default formats (and usually the custom renderers) should obey the rules described here.
Two examples of a filled in control:
The default renderers use one or more lines to show the selected value, depending on how they are configured. By default each value column is shown on a separate line but this can be changed so that columns are joined in one line.
How the value is to be presented depends on how many lines it has, but both representations must take care not to show as an "input" control. In the above example this is done by giving them a background gradient. FIXME: what to do for colorblindness?
In this state both the lookup and the clear buttons are enabled. Pressing the "clear" button will remove the selected value and move back to either "normal" or "quicksearch" state. Pressing the lookup button will show the lookup dialog with empty search fields. If the user selects a new value there then the value will be overwritten and the control remains in "Value Display" state. If no value is selected the old value remains.
One-line values
A one line value must show at the same size as the input box, and the tops and bottoms of the box around the value must align with the top and bottom of the button boxes so that top and bottom of the whole control form one continued line. A one line value should not show anything else than that value, and value should be self-evident from the label before/above the control.
Multiline values
For a multiline value the value box should extend downwards without extending the apparent boxes around the buttons behind the control (as can be seen in the 2nd example above).
Each line should have some indication of what the line's text represents (either a label or an icon), unless the text is self-evident from the context.