FIX: Work around a problem in QT (since Lazarus 20794) where the tab caption cannot be changed after creation until it is visible.

This commit is contained in:
cobines 2009-09-18 19:55:06 +00:00
commit 0b329dd047
2 changed files with 11 additions and 5 deletions

View file

@ -2559,7 +2559,11 @@ begin
sCaption:= GetLastDir(ExcludeTrailingPathDelimiter(sPath));
end;
Page := ANoteBook.AddPage;
if sCaption <> '' then
if (tb_text_length_limit in gDirTabOptions) and (Length(sCaption) > gDirTabLimit) then
sCaption := Copy(sCaption, 1, gDirTabLimit) + '...';
Page := ANoteBook.AddPage(sCaption);
if not Assigned(CreateFileView('columns', TFileSystemFileSource.Create(sPath), Page)) then
begin
@ -2571,7 +2575,6 @@ begin
if Page.LockState = tlsResettingPath then // if locked tab with directory change
Page.LockPath := sPath;
Page.UpdateCaption(sCaption);
Page.FileView.LoadConfiguration(TabsSection, StrToInt(sIndex));
Inc(I);

View file

@ -72,7 +72,7 @@ type
constructor Create(ParentControl: TWinControl;
NotebookSide: TFilePanelSelect); reintroduce;
function AddPage: TFileViewPage;
function AddPage(aCaption: String = ''): TFileViewPage;
procedure RemovePage(Index: Integer);
procedure RemovePage(var aPage: TFileViewPage);
procedure ActivatePrevTab;
@ -251,11 +251,14 @@ begin
end;
end;
function TFileViewNotebook.AddPage: TFileViewPage;
function TFileViewNotebook.AddPage(aCaption: String): TFileViewPage;
var
PageNr: Integer;
begin
PageNr := Pages.Add(IntToStr(PageCount));
if aCaption = '' then
aCaption := IntToStr(PageCount);
PageNr := Pages.Add(aCaption);
Result := GetPage(PageNr);
ShowTabs:= ((PageCount > 1) or (tb_always_visible in gDirTabOptions)) and gDirectoryTabs;