Using the IsPropertyInCategory Function

From RAD Studio
Jump to: navigation, search

Go Up to Property Categories


An application can query the existing registered properties to determine whether a given property is already registered in a specified category. This can be especially useful in situations like a localization utility that checks the categorization of properties preparatory to performing its localization operations. Two overloaded variations of the IsPropertyInCategory function are available, allowing for different criteria in determining whether a property is in a category.

The first variation lets you base the comparison criteria on a combination of the class type of the owning component and the property's name. In the command line below, for IsPropertyInCategory to return True, the property must belong to a TCustomEdit descendant, have the name "Text," and be in the property category 'Localizable'.

IsItThere := IsPropertyInCategory('Localizable', TCustomEdit, 'Text');
IsItThere = IsPropertyInCategory("Localizable", __classid(TCustomEdit), "Text");

The second variation lets you base the comparison criteria on a combination of the class name of the owning component and the property's name. In the command line below, for IsPropertyInCategory to return True, the property must be a TCustomEdit descendant, have the name "Text", and be in the property category 'Localizable'.

IsItThere := IsPropertyInCategory('Localizable', 'TCustomEdit', 'Text');
IsItThere = IsPropertyInCategory("Localizable", "TCustomEdit", "Text");