An easy one. How to copy a button

Hello everybody.
I'm a begginer.
I have made a button using the PARENT, CREATE etc. commands.
And it shows on the form.

I dont want to use the VCL or the allready made button and put it six tims on the form.

Now I want to copy the same button 6 times in 20 points interval space.
And I dont know how to do it.
Please help.
LVL 1
liorbAsked:
Who is Participating?
 
StevenBConnect With a Mentor Commented:
I can't really understand what you're asking. Is it something like this:

var
  i : Integer;
  aButton : TButton;
begin
  for i := 1 to 6 do
  begin
    aButton := TButton.Create(Self);
    aButton.Caption := Button1.Caption;
    aButton.Left := Button1.Left;
    aButton.Top := Button1.Top + (i * 20);
    aButton.Parent := Self;
  end;
end;
0
 
liorbAuthor Commented:
steve
thanks

yes this is it
so simple

but i'm a begginer
have much to learn

thank you very much.

Lior
0
 
mikelittlewoodCommented:
A nice idea is to select the control on the form you are looking to copy, then do a normal windows CTRL+C, then go to notepad or something and then past the button to it. You can get a good idea of the basic properties you need to set for all components this way. Just a little bit of info for a beginner.
0
 
liorbAuthor Commented:
mike

thanks for the BIG tip.

Lior
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.