Delphi Object Inspector

Posted on  by  admin

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).

Prvi link za download: http://www.mediafire.com/download/vcq599og9jd871v/Steelseries+cs++1. Cs 1.6 steelseries by pole

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 a GetAttributes method that returns a set of attributes that apply to the editor.

Delphi Object Inspector

If the set includes paMultiSelect, 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 sets paMultiSelect, but based on your pictures, the property editor to TSizeConstraints 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. Override GetAttributes to return the value you need.

Inspector

Delphi Object Was Open

Finally, follow examples elsewhere in the code to call RegisterPropertyEditor.

Delphi Object Inspector Shortcut

Following on from this question I recently posted: I have created a ComponentEditor for a new component that when executed shows a TOpenDialog to select a configuration File. When a File is loaded I read the data and copy the values to the calling component (which is Component as this is a TComponentEditor). There are no problems at all, except that the Object Inspector is not updating to reflect the newly changed values - It only updates when clicking back on the component in the Designer. It might not seem like such a big a deal, but I need the Object Inspector to update itself somehow so that I can see the properties have changed successfully (without having to switch focus back to the control). So, is there some way of letting Delphi know that it should update/refresh the Object Inspector?

Coments are closed