Converting a delphi form to an activeX form

I have an existing delphi form, which I would like to use as is as an activeX form, however the activeX form wizard only allows the activeX form to be inherited from TActiveXForm.

How can I convert my form to an activeX form without copy and paste??
gavindewAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
Listening
0
intheCommented:
Hi,
this is from a faq:

Converting a standard Delphi Form to an ActiveForm

By Conrad Herrmann, 25 July 1997

 

People ask me this question often, and there are several techniques that can do this. The technique that I prefer is easy to learn and the most flexible. In this technique, you make your existing Delphi form a child window of an otherwise ActiveForm. Because it’s a child form, you’ll have to add code to set some of its properties to reflect that fact—to remove the window frame, to align it to its parent’s client area, etc.

This approach has several advantages. The first advantage is that its easy to get up and running—the only thing you need to do that’s not already done for you is to add code to create and embed your form in the ActiveForm. Another advantage is that unlike copying your code to the ActiveForm’s implementation file, this approach doesn’t change your form’s implementation at all. The code you’re familiar with is still familiar. It also means the form’s implementation unit can still be included in a regular Delphi application if you so desire.

 

Steps to convert a Delphi form to an ActiveForm:

Create a blank ActiveForm.
In the form’s property inspector, add an Create handler like the one shown below:

Procedure TActiveForm1.FormCreate(Sender: TObject);
begin
// This code creates a child form that is just a normal
// Delphi TForm.
// This allows the form to be shown both as a normal
// VCL form and as an ActiveForm.
ChildForm := TForm1.Create( Self );
ChildForm.Parent := Self;
ChildForm.Align := alClient;
ChildForm.BorderStyle := bsNone;
ChildForm.Visible := True;

end;
In the uses clause, add a reference to your form’s unit (in this case, Unit1).
Add the form’s implementation unit to the project (in this case, Unit1.pas).
Add the declaration of ChildForm to your TActiveForm1 class, like this:

type
TActiveForm1 = class ...
.....
public
ChildForm: TForm1;
.....
end;

Compile and test your form.

Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
intheCommented:
another couple o ways(yes the first one involve cut'n'paste but its quick ;-)

Select everything on the form, including non-visual components, but not the form itself.
Copy them.
Now, Close the project and choose New|ActiveForm.
The IDE will create a new Dll project for you, and then a new ActiveForm. Now, paste the clipboard!
 
There's your form, including all the code attached to the components
 
Another way:
Select everything on the form, except the form
Choose Component|CreateComponentTemplate
 this will make a new component and put on your templates tab
use the ActiveForm wizard and put your componenttemplate on the active form.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.