Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Clearing a panel
Tue, Aug 20 2013 11:01 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Is there any way to delete all of the items from a TPanel at runtime?


--
Chris Holland
[Team Elevate]
Tue, Aug 20 2013 12:59 PMPermanent Link

Uli Becker

Chris,

this should work:

procedure TForm1.ClearPanel(Sender: TObject);
var
 i: integer;
 c: TComponent;
begin
  for i := componentcount - 1 downto 0 do
  begin
    c := component[i];
    if TControl(c).parent = sender then
      c.free;
  end;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  ClearPanel(Panel1);
end;
Tue, Aug 20 2013 4:12 PMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Thanks Uli,

That works great.

Chris Holland
[Team Elevate]

On 20/08/2013 17:59, Uli Becker wrote:
>   c: TComponent;
Image