I've noticed that some properties disappear from the Object Inspector when selecting more than one item.
Why does this happen and how to control this behavior when creating a component?
Example:
Add 2 buttons (TButton
) to a form and select one of them.
In the Object Inspector you can see all TButton
's published properties (Note that there's also the Constraints
property).
Add the other button to the current selection (Click while pressing Shift key).
As you can see, some properties have been hidden from Object Inspector (Note that the Constraints
is no more visible).
Whether a property is displayed when multiple objects are selected is controlled by the property editor configured for that property. Property editors (descended from
TPropertyEditor
in DesignEditors.pas) have aGetAttributes
method that returns a set of attributes that apply to the editor. If the set includespaMultiSelect
, then the property will be displayed.Given that the property value is displayed as the constraint values, rather than just (TSizeConstraints), I conclude that that property is not using the generic
TClassProperty
editor. That editor setspaMultiSelect
, but based on your pictures, the property editor toTSizeConstraints
doesn't. It was probably an oversight.You could try registering your own property editor. Find the property editor currently registered for
TSizeConstraints
(by searching the source code for TSizeConstraints, for instance) and, in a design-time package, declare a new class descended from that one. OverrideGetAttributes
to return the value you need. Finally, follow examples elsewhere in the code to callRegisterPropertyEditor
.