win32: apply patch of cobines to fix page size after a tab caption change (bug #0018955)

git-svn-id: trunk@35199 -
This commit is contained in:
paul 2012-02-07 05:11:44 +00:00
parent a8da22e5ec
commit 2dad53e522

View File

@ -169,12 +169,14 @@ end;
class procedure TWin32WSCustomPage.SetText(const AWinControl: TWinControl; const AText: string); class procedure TWin32WSCustomPage.SetText(const AWinControl: TWinControl; const AText: string);
var var
TCI: TC_ITEM; TCI: TC_ITEM;
TabControl: TCustomTabControl;
PageIndex, RealIndex: integer; PageIndex, RealIndex: integer;
TabControlHandle: HWND; TabControlHandle: HWND;
begin begin
TabControl := TCustomTabControl(AWinControl.Parent);
PageIndex := TCustomPage(AWinControl).PageIndex; PageIndex := TCustomPage(AWinControl).PageIndex;
RealIndex := TCustomTabControl(AWinControl.Parent).PageToTabIndex(PageIndex); RealIndex := TabControl.PageToTabIndex(PageIndex);
TabControlHandle := AWinControl.Parent.Handle; TabControlHandle := TabControl.Handle;
// We can't set label of a page not yet added, // We can't set label of a page not yet added,
// Check for valid page index // Check for valid page index
if (RealIndex >= 0) and (RealIndex < Windows.SendMessage(TabControlHandle, TCM_GETITEMCOUNT, 0, 0)) then if (RealIndex >= 0) and (RealIndex < Windows.SendMessage(TabControlHandle, TCM_GETITEMCOUNT, 0, 0)) then
@ -200,6 +202,7 @@ begin
TCI.pszText := PChar(AText); TCI.pszText := PChar(AText);
Windows.SendMessage(TabControlHandle, TCM_SETITEM, RealIndex, LPARAM(@TCI)); Windows.SendMessage(TabControlHandle, TCM_SETITEM, RealIndex, LPARAM(@TCI));
{$endif} {$endif}
LCLControlSizeNeedsUpdate(TabControl, True);
end; end;
end; end;
end; end;