LMD DesignPack Guide


Property Inspector


TLMDPropertyInspector is a control that provides functionality similar to Borland Delphi's object inspector. The Selection property of a Property Inspector must be set to a TLMDDesignObjects component.

 

Property inspector displays properties of objects that are included in the Selection collection. So, like Delphi object inspector, TLMDPropertyInspector supports displaying properties of several objects at once. It also facilitates working with events, supports categories of properties and provides a rich set of properties to customize its appearance.

 

Property Editors

 

Every shown property item has an associated property editor. This is an instance of a descendant of TLMDPropEditor class. This instance is created by property inspector. Its lifetime is also controlled by property inspector, so a property inspector is allowed to destroy and recreate property editors when it wants.

 

There are two predefined sets of property editors:

 

First set of property editors allows for showing and editing of standard Delphi language types, like Integer, Double, String, Component reference (TComponent), method reference (events), enumerations, sub-ranges, sets, etc. This set of property editors is fundamental and hard-coded into property inspector. There property editors are also useful as base classes for other custom property editors.

Second set of property editors – are property editors for VCL types, like TFont, TColor, TCollection, TPicture, TCaption, TComponentName, etс. This set of property editors is also automatically pre-registered.

 

Property inspector also supports custom property editors registration. If you need some special property editing behavior, for example to enhance standard property editor functionality or because you have a property of non VCL type – you need to write your own property editor. To write a custom property editor you need to declare a class as a descendant of TLMDPropEditor or one of existing property editors and override its virtual functions. The best examples of how to write custom property editor is to look at predefined property editors implementations.

 

Non-modal property editors, such as TCollection editor dialog should always be bound to some editor window manager. The property inspector automatically searches for the designer of the editing component and use designer's EditorWindows as a window manager for all opening non-modal editors. If the designer for editing component is not exist, then the editor dialog will not be shown at all.

 

Property Inspector Appearance

 

TLMDPropertyInspector have various properties that control its visual appearance. By changing values of such properties you can mimic old Delphi visual style, MS Visual Studio style or new Delphi IDE style.

 

Delphi like property categories is also supported. Call predefined LMDRegisterStandardCategories function to register VCL like categories. You can also register your own property categories by using TLMDPropertyInspcetor.RegisterPropCategory method family.

 

The property inspector supports property caption highlighting. So, you can highlight some important to end-user properties by changing its caption color. This can be achieved by writing OnGetCaptionColor event handler. Also, like in Delphi IDE, property inspector highlights non-default property values.

 

Sometimes it is not needed to show all object properties. So, you can filter shown properties by writing OnFilterProp event handler. This can help you restrict an end-user. For example, you might write an application where some visualization details, like fonts and colors can be centralized, so you will need to hide such properties from editing its at individual object level.

 

You can also translate property names to your native language by writing OnTranslateProp event handler.

 

When TLMDPropertyInspector modifies some objects it dispatches Global component modification notifications. So allowing all other LMD-DesignPack controls to update they view.

 

Working with events and component references

 

TLMDPropertyInspector uses TLMDModule functionality for working with events and component references. That is it automatically searches for the module that correspond to editing component and redirect events and component references handling to it. Look at OnGetCompRefName, OnGetCompRefList, OnGetCompRef, OnGetEventHandlerName and other related events of the TLMDModule component.