Show: Delphi C++
Display Preferences

Registering Multiple Properties at Once

From RAD Studio
Jump to: navigation, search

Go Up to Property Categories

Register multiple properties at one time and associate them with a property category using the RegisterPropertiesInCategory function. RegisterPropertiesInCategory comes in three overloaded variations, each providing a different set of criteria for identifying the property in the custom component to be associated with property categories.

The first variation lets you identify properties based on property name or type. The list is passed as an array of constants. In the example below, any property that either has the name "Text" or belongs to a class of type TEdit is registered in the category 'Localizable.'

RegisterPropertiesInCategory('Localizable', ['Text', TEdit]);
RegisterPropertiesInCategory("Localizable", ARRAYOFCONST("Text", __typeinfo(TEdit)));

The second variation lets you limit the registered properties to those that belong to a specific component. The list of properties to register include only names, not types. For example, the following code registers a number of properties into the 'Help and Hints' category for all components:

RegisterPropertiesInCategory('Help and Hints', TComponent, ['HelpContext', 'Hint', 'ParentShowHint', 'ShowHint']);
RegisterPropertyInCategory("Help and Hints", __classid(TComponent), ARRAYOFCONST("HelpContext", "Hint", "ParentShowHint"));

The third variation lets you limit the registered properties to those that have a specific type. As with the second variation, the list of properties to register can include only names:

RegisterPropertiesInCategory('Localizable', TypeInfo(String), ['Text', 'Caption']);
RegisterPropertiesInCategory("Localizable", __typeinfo(TStrings), ARRAYOFCONST("Lines", "Commands"));

See the section Specifying Property Categories for a list of the available property categories and a brief description of their uses.

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions