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

How to free tabsheets recursively.

Taking an example from the delphi help
pages, how can I free my tabsheets from
the example below. I want to recurse
through the tabsheets and free them, then recreate them as needed. The example below doesn't work. Can anyone
tell me what I'm doing wrong. A working
example would be nice
thanks, michael

    for i := Low(DetailTabs) to High(DetailTabs) do
 with TabSheet.Create(PageControl2) do
  begin
   PageControl:=PageControl2;
   Name :='ts' + DetailTabs[i]; //array
   Caption := DetailTabs[i];
   end;
   end
  else
 begin
  for i:= 0 to PageControl2.PageCount -1 do PageControl2.ActivePage:=PageControl2.Pages[i];
   PageControl2.ActivePage.Free;
end;
end;
0
mmcgurl
Asked:
mmcgurl
  • 2
1 Solution
 
hubdogCommented:
 for i:= PageControl1.PageCount -1 downto 0 do begin
     PageControl1.ActivePage:=PageControl1.Pages[i];
    PageControl1.ActivePage.Free;
  end;
this works fine in my computer
0
 
rwilson032697Commented:
Listening
0
 
rwilson032697Commented:
This is how I create a tabsheet and attach it to a pagecontrol:

      TheTabSheet := TTabSheet.Create(Self);
      TheTabSheet.Parent := EditorPageControl;
      TheTabSheet.PageControl := EditorPageControl;
      TheTabSheet.Caption := 'Editor';

Apart from the .parent settings its the same...

Cheers,

Raymond.
0
 
mmcgurlAuthor Commented:
Thanks alot!
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

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