Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 16153, Categories in the Object Inspector

by Pablo Reyes Email: Anonymous


In Delphi 5 the object inspector allow us to view properties and events by categories. How to use it with our components?
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 5.0  to 5.0 188 downloads
Copyright: No significant restrictions


Size: 851 bytes
Updated on Tue, 15 May 2001 06:56:55 GMT
Originally uploaded on Tue, 15 May 2001 06:56:20 GMT
SHA1 Hash: 5F8DF087CF883C911D42B4BC3E9928FD84675F74
MD5 Hash: 16044AA7647D57A2D8D75B64BD617A4C

    Explore the files in this upload

Description
We can instruct Delphi which category the properties and events of our components belongs to and even to create our own categories.

1. To instruct Delphi which category a property belongs to:
We have to do that in the Register procedure. The function RegisterPropertyInCategory has four overloaded versions. This is one of them. In this version we instruct Delphi to assign the property "Version" of our component "TMyButton" to the "TMiscellaneousCategory" standard category.

procedure Register;
begin
RegisterComponents('Samples', [TMyButton]);
RegisterPropertyInCategory(TMiscellaneousCategory , TMyButton, 'Version');
end;

Search Delphi help for more information about other overloaded versions of this function.

2.To create our own category:
We have to create a new class and derive it from TPropertyCategory or one of the existing categories (for example TMiscellaneousCategory). Then, we need to override the Name class function. The result value is the name shown by the object inspector.

Interface

TMyCategory = class(TPropertyCategory)
public
class function Name: string; override;
end;

Implementation

class function TMyCategory.Name: string;
begin
Result := 'My Category';
end;

Then we could use our new category.

procedure Register;
begin
RegisterComponents('Samples', [TMyButton]);
RegisterPropertyInCategory(TMyCategory , TMyButton, 'Version');
end;

You can also use RegisterPropertiesInCategory to register more than one property with one category at a time.

Have fun!

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03