Re: How to create Delphi Object given its name and class name?

Posted by Tom Barnet on September 05, 2008

In Reply to How to create Delphi Object given its name and class name? posted by dohamsg on August 22, 2008

Hello,

I did not follow/learn the above url. But maybe you need to store all of the created forms in a list (TList)?

Also, if you have a class-reference, you can always create a new instance of that class.
For example:
type TMyFormClass = class of TForm;
NewForm:= TMyFormClass.Create();

In addition, any object has a ClassType property, so if you have an instance of a class, you can get its class-reference. Sometimes, it's only required to make a type-cast first such as:
ANewFormClass:= TMyFormClass(ThisForm.ClassType);

The above examples are just what I usually do on my own applications. Hope that helps.

Sincerely,
Tom Barnet
HelpSmith 2.0. Help Authoring with Dynamic Styles.

Related articles

       

Follow Ups