Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TformMain.btnTestClick(Sender: TObject);
- var
- btn: TButton;
- btnCollection: TObjectList<TButton>;
- i: integer;
- begin
- btnCollection := TObjectList<TButton>.Create(True);
- for i := 0 to 10 do
- begin
- btn := TButton.Create(Nil);
- btn.Parent := Self;
- btn.Left := i * 10;
- btn.Width := 100;
- btn.Top := 100;
- btn.Caption := VarToStr(i);
- btnCollection.Add(btn);
- end;
- btnCollection.Free;
- btnCollection := TObjectList<TButton>.Create(False);
- for i := 0 to 10 do
- begin
- btn := TButton.Create(Nil);
- btn.Parent := Self;
- btn.Left := i * 10;
- btn.Width := 100;
- btn.Top := 100;
- btn.Caption := VarToStr(i);
- btnCollection.Add(btn);
- end;
- for i := 0 to 10 do
- begin
- btnCollection.Items[i].Free;
- end;
- btnCollection.Free;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement