• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 175
  • Last Modified:

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.
0
liorb
Asked:
liorb
  • 2
1 Solution
 
StevenBCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now