From cbf60e2a8b28e2e8b845b3d271bc2bdc7401d745 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 24 Apr 2020 16:29:11 +0000 Subject: [PATCH] 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 --- .../run/JvPageComps/jvnotebookpagelist.pas | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/components/jvcllaz/run/JvPageComps/jvnotebookpagelist.pas b/components/jvcllaz/run/JvPageComps/jvnotebookpagelist.pas index cff8cf0e9..1a1f2769e 100644 --- a/components/jvcllaz/run/JvPageComps/jvnotebookpagelist.pas +++ b/components/jvcllaz/run/JvPageComps/jvnotebookpagelist.pas @@ -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);