Show: Delphi C++
Display Preferences


From RAD Studio API Documentation
Jump to: navigation, search


procedure RegisterPropertyEditor(PropertyType: PTypeInfo; ComponentClass: TClass; const PropertyName: string; EditorClass: TPropertyEditorClass);


extern DELPHI_PACKAGE void __fastcall RegisterPropertyEditor(System::Typinfo::PTypeInfo PropertyType, System::TClass ComponentClass, const System::UnicodeString PropertyName, TPropertyEditorClass EditorClass);


Type Visibility Source Unit Parent
DesignIntf DesignIntf


Allows a component to bring up a custom property editor from the Object Inspector.

Call RegisterPropertyEditor to associate the property editor class specified by the EditorClass parameter with the property type specified by the PropertyType parameter.

When a component is selected, the Object Inspector creates a property editor for each of the component's properties, based on the type of the property. For example, if the property type is an Integer, the property editor for Integer will be created (by default that would be TIntegerProperty). Most properties do not need specialized property editors. For example, if the property is an ordinal type, the default property editor will restrict the range to the subtype range.

When a property type cannot be properly edited using the default property editor or one of the existing property editors, use RegisterPropertyEditor to associate a custom property editor with the property type. This is typically because the property is an object.

When registering a property editor, set PropertyType to the type information pointer. In Delphi, the type information pointer is returned by the TypeInfo function. For example, TypeInfo(TPropertyObject). In C++, if the property type is a class, you can use the __typeinfo macro to obtain this pointer. For other types, you can obtain the type information pointer from a published property of the same type. For example:

PTypeInfo TypeInfo;
PPropInfo PropInfo =GetPropInfo(__typeinfo(TForm), "BorderStyle");
if (PropInfo)
TypeInfo = *(PropInfo->PropType);

Set the ComponentClass parameter to restrict the property editor to a component class and its descendants. Setting ComponentClass to nil (Delphi) or NULL (C++) associates the property editor with the property type for any component.

Set the PropertyName parameter to restrict the property editor to properties with a specific name as well as the specified property type. Setting PropertyName to an empty string associates the property editor with any property of the specified type.

Set the EditorClass parameter to the class of the property editor that should be displayed when the property is selected in the Object Inspector. This class must be a descendant of TBasePropertyEditor that implements the IProperty interface.

See Also

Code Examples

Personal tools
In Other Languages
Previous Versions