Mirror

Testing new component without installing it (Views: 100)


Problem/Question/Abstract:

How can I test a component without installing it?

Answer:

If you are developing a new component, it takes a lot of time to test every change by installing the component. But there is a easier way to do this:

First, create a new project.

Then add the unit with the component's source code to the 'uses ...' line.

The last thing you have to do is to add the OnCreate event of your form an add the code as shown in the following example.

procedure TForm1.FormCreate(Sender: TObject);
begin
  with TComponent1.Create(self) do
  begin
    Parent := self; // This makes the component visible at runtime
    {now you can define the values for other properties }
    Caption := '...';
    Left := 100;
    Top := 100;
    {...}
  end;
end;

<< Back to main page