RAD Studio |  |

Registering One Property at a Time

Register one property at a time and associate it with a property category using the RegisterPropertyInCategory function. RegisterPropertyInCategory comes in four overloaded variations, each providing a different set of criteria for identifying the property in the custom component to be associated with the property category.

The first variation lets you identify the property by the property's name. The line below registers a property related to visual display of the component, identifying the property by its name, "AutoSize".

Copy Code

    RegisterPropertyInCategory('Visual', 'AutoSize');

Copy Code

    RegisterPropertyInCategory("Visual", "AutoSize");

The second variation is much like the first, except that it limits the category to only those properties of the given name that appear on components of a given type. The example below registers (into the 'Help and Hints' category) a property named "HelpContext" of a component of the custom class TMyButton.

Copy Code

    RegisterPropertyInCategory('Help and Hints', TMyButton, 'HelpContext');

Copy Code

    RegisterPropertyInCategory("Help and Hints", __classid(TMyButton), "HelpContext");

The third variation identifies the property using its type rather than its name. The example below registers a property based on its type, Integer.

Copy Code

    RegisterPropertyInCategory('Visual', TypeInfo(Integer));

Copy Code

    RegisterPropertyInCategory("Visual", typeid(TArrangement));

The final variation uses both the property's type and its name to identify the property. The example below registers a property based on a combination of its type, TBitmap, and its name, "Pattern."

Copy Code

    RegisterPropertyInCategory('Visual', TypeInfo(TBitmap), 'Pattern');

Copy Code

    RegisterPropertyInCategory("Visual", typeid(TBitmap), "Pattern");

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

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!