jvcllaz: Some corrections of TJvNotebookPageList. Issue #36956, patch by Michal Gawrycki.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7398 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-04-24 16:29:11 +00:00
parent 71e0209dda
commit cbf60e2a8b

View File

@ -21,7 +21,7 @@ unit JvNotebookPageList;
interface
uses
Classes, SysUtils, ExtCtrls,
Classes, SysUtils, ExtCtrls, LCLVersion,
JvPageList;
type
@ -72,13 +72,8 @@ end;
-------------------------------------------------------------------------------}
procedure TJvNotebookPageList.AddPage(const ACaption: String);
var
idx: Integer;
lPage: TPage;
begin
idx := Pages.Add(ACaption);
lPage := Page[idx];
lPage.Name := GetUniqueName(Self, 'TPage');
Pages.Add(ACaption);
end;
function TJvNotebookPageList.CanChange(AIndex: Integer): Boolean;
@ -95,7 +90,7 @@ end;
function TJvNotebookPageList.GetPageCaption(AIndex: Integer): string;
begin
Result := Pages[AIndex];
Result := Page[AIndex].Caption;
end;
function TJvNotebookPageList.GetPageCount: Integer;
@ -105,13 +100,19 @@ end;
procedure TJvNotebookPageList.MovePage(CurIndex, NewIndex: Integer);
begin
{$IF LCL_FullVersion >= 2010000}
Pages.Move(CurIndex, NewIndex); // Fix for issue #36956
{$ELSE}
Pages.Exchange(CurIndex, NewIndex);
// Note: This code is not working (issue #36956), it exchanges the captions,
// not the pages. Required changes in TNotebook are available only in Laz 2.1+
{$IFEND}
end;
procedure TJvNotebookPagelist.PageCaptionChanged(AIndex: Integer;
const NewCaption: string);
begin
Pages[AIndex] := NewCaption;
Page[AIndex].Caption := NewCaption;
end;
procedure TJvNotebookPageList.SetActivePageIndex(AIndex: Integer);