Mastodon
Programmierung

New TForm with new Properties

Q:
I have created a new TForm class called TNewForm. And added a few published
properties. Then added it to repository.
Now, what should I do to see those properties in Object Inspector?

Can anyone advise me on how to create a new form component (based on >TForm),
that i can use in my projects and put other controls on it
during design time?

A1:
You need to register your new class as a custom module using
RegisterCustomModule. Search these groups using
http://www.dejanews.com for “RegisterCustomModule” and you should find
some code samples as well.

A2:
You need to register the form with the IDE.
1) Publish the property or event.
2) Add the Custom form to the Object repository.
3) Add the form to a package [eventually create a new (design time)
package]
4) Add to the package the following Register procedure

[code lang=”delphi”][interface]
procedure Register;

[implementation]
uses dsgnIntf;
procedure Register;
begin
RegisterCustomModule(TMyCustomForm, TCustomModule);
end;
[/code]
5) Install the package in Delphi
6) Create a new form that inherits (make sure that you do not copy or
use) from your custom form. You should now see the extra events and
properties.

[tags]Delphi, Forms[/tags]

0 Kommentare zu “New TForm with new Properties

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.