How to put a component lazarus / 10-Designer ---------------------------------------------------------------------- LazaruX · 2007-10-16 10:01 I would like to know how to put a new component in the form without dragging it, but writing a code for it. I though something like this: Code: [Select] application.create(tbutton); but this does not work. any suggestions? I only need to put imag components ---------------------------------------------------------------------- Vincent Snijders · 2007-10-16 10:17 Take a look at the hello example. ---------------------------------------------------------------------- ssamayoa · 2007-10-16 14:47 Code: [Select] procedure TForm1.SomeMethod... var   Button: TButton; begin   Button := TButton.Create(Self);   Button.Parent := Self;   Button.Top := 50;   Button.Left := 50;   ... end; ---------------------------------------------------------------------- antonio · 2007-10-16 14:57 After use, you need to free it. ---------------------------------------------------------------------- Marc · 2007-10-16 16:25 You don't need to free it if you pass an owner (like in the example). Then the component is freed when the owner is freed ---------------------------------------------------------------------- antonio · 2007-10-16 17:19 Sure. Sorry. ---------------------------------------------------------------------- LazaruX · 2007-10-17 10:31 OK, thanks for your replies, and now another question before you understand what I mean better that I explain what I am making: I am making a program that add's some things to the unit1.pas file, it add's this code: procedure FormCreate..... begin ... .... end; but then I need to click on the OnCreate event, otherwise the code will not work. Is there a way to code the clicking of the OnCreate event? I hope you understand what I mean. ---------------------------------------------------------------------- ssamayoa · 2007-10-17 16:21 CreateForm() event is called after form is created and components are loaded: Code: [Select] procedure TForm1.FormCreate(Sender: TObject); begin   // Put here your custom control creation end; Check in object inspector if form's event OnCreate is linked to FormCreate method. ---------------------------------------------------------------------- LazaruX · 2007-10-17 16:53 Hi, thanks for the reply, maybe I have not been clear, I will try to explain again what I mean: is there a way to link the Object Inspector On create event directly to the FormCreate, without the need to go to the Object Inspector and click ther? Is there a way to code this linking? ---------------------------------------------------------------------- antonio · 2007-10-17 17:24 form1.oncreate := @formcreate;