Testing new component without installing it (Views: 100)


How can I test a component without installing it?


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);
  with TComponent1.Create(self) do
    Parent := self; // This makes the component visible at runtime
    {now you can define the values for other properties }
    Caption := '...';
    Left := 100;
    Top := 100;

<< Back to main page