Merge branch 'lcl/notebook' into 'main'

FIX #40019: LCL/TPageControl: FIX algorithm of clear tabs in TNBPages.Clear()

See merge request freepascal.org/lazarus/lazarus!122
This commit is contained in:
Bart B 2022-12-03 14:10:15 +00:00
commit 1af6a0e61f

View File

@ -105,9 +105,15 @@ end;
TNBPages Clear
------------------------------------------------------------------------------}
procedure TNBPages.Clear;
var
i: Integer;
begin
while FPageList.Count>0 do
Delete(FPageList.Count-1);
// remove the pages in reverse order but skip the Active Page,
// and remove the Active Page at the end,
// to avoid activating other Pages.
for i:=FNoteBook.PageCount-1 downto 0 do
if i<>FNoteBook.PageIndex then Delete(i);
if FNoteBook.PageCount>0 then Delete(0);
end;
{------------------------------------------------------------------------------