Registering One Property at a Time

From RAD Studio
Jump to: navigation, search

Go Up to Property Categories

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

RegisterPropertyInCategory('Visual', 'AutoSize');
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.

RegisterPropertyInCategory('Help and Hints', TMyButton, 'HelpContext');
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.

RegisterPropertyInCategory('Visual', TypeInfo(Integer));
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."

RegisterPropertyInCategory('Visual', TypeInfo(TBitmap), 'Pattern');
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.