Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Remove all pages from a TPagePanel
Tue, Jan 26 2016 8:08 AMPermanent Link

Michael Dreher

Hi,
to remove all pages from a TPagePanel I've written a function

procedure RemoveAllPages(pagePanel : TPagePanel);
begin                 
 while (pagePanel.PageCount > 0) do
   pagePanel.Pages[0].Close;
end;

that was working fine until I compiled the code under 2.04 B1, where I get an
 -  "can't access property ttab_setactive that is null or undefined"
script error, when "RemoveAllPages" removed some pages, and the the next time
a TPage constructor is called with:

  - page   := TPage.Create(ppControl);

Is something wrong removing pages this way? Please have a look. The complete code is in the attachment.

Michael Dreher



Attachments: PagePanelRemovePages.zip
Tue, Jan 26 2016 12:05 PMPermanent Link

Trinione

Michael:

What about:
   PagePanel1.ActivePage := PagePanel1.Pages[i];
   PagePanel1.RemoveActivePage;
Tue, Jan 26 2016 1:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< that was working fine until I compiled the code under 2.04 B1, where I get an  -  "can't access property ttab_setactive that is null or undefined" script error, when "RemoveAllPages" removed some pages, and the the next time a TPage constructor is called with: >>

Sounds like a bug.  I'll have a fix for this in the next build.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jan 28 2016 2:02 AMPermanent Link

Michael Dreher

Trinione wrote:

  /// Michael:
  ///
  /// What about:
  ///     PagePanel1.ActivePage := PagePanel1.Pages[i];
  ///     PagePanel1.RemoveActivePage;

Thanks. I tried various methods....

procedure RemoveAllPages_OtherMethod(pagePanel : TPagePanel);
begin                 
 while (pagePanel.PageCount > 0) do
 begin  
   pagePanel.ActivePage := pagePanel.Pages[0];
   pagePanel.RemoveActivePage();
 end;
end;             

procedure RemoveAllPages_Another_OtherMethod(pagePanel : TPagePanel);
var k : integer;
begin           
 for k := pagePanel.PageCount - 1 downto 0 do
 begin    
   pagePanel.Pages[k].Close();
 end;
end;

procedure RemoveAllPages_Another_Another_OtherMethod(pagePanel : TPagePanel);
var k : integer;
begin           
 for k := pagePanel.PageCount - 1 downto 0 do
 begin           
   pagePanel.ActivePage := pagePanel.Pages[k];
   pagePanel.RemoveActivePage();
 end;
end;

... but they all failed for the same reason. For study the code is in the attachment.

Michael Dreher



Attachments: PagePanelRemovePages.zip
Thu, Jan 28 2016 10:55 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

It turns out that this was already fixed from another report, so it's "all good" for the next build.

Tim Young
Elevate Software
www.elevatesoft.com
Image