LCL: Use AlignControls in TCoolBar to prevent setting alignment of controls associated with bands. Issue #26096, patch from Vojtech Cihak

git-svn-id: trunk@44861 -
This commit is contained in:
juha 2014-04-30 20:27:33 +00:00
parent a3cf4354b2
commit 978eda5ac9
2 changed files with 21 additions and 2 deletions

View File

@ -2272,6 +2272,8 @@ type
cHorSpacing = 7;
cVertSpacing = 3;
protected
FControlLeft: Integer;
FControlTop: Integer;
function CalcPreferredHeight: Integer;
function CalcPrefferedWidth: Integer;
function GetDisplayName: string; override;
@ -2361,6 +2363,7 @@ type
FPrevHeight: Integer;
FPrevWidth: Integer;
FTextHeight: Integer;
procedure AlignControls(AControl: TControl; var RemainingClientRect: TRect); override;
procedure BitmapOrImageListChange(Sender: TObject);
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
{%H-}WithThemeSpace: Boolean); override;

View File

@ -409,6 +409,21 @@ begin
Invalidate;
end;
procedure TCustomCoolBar.AlignControls(AControl: TControl; var RemainingClientRect: TRect);
var i: Integer;
begin
//DebugLn('AlignControls');
for i:=0 to Bands.Count-1 do
if assigned(Bands[i].FControl) then begin
Bands[i].FControl.Align:=alNone;
Bands[i].FControl.BorderSpacing.Around:=0;
Bands[i].FControl.Anchors:=[akLeft, akTop];
Bands[i].FControl.AnchorParallel(akLeft, Bands[i].FControlLeft, self);
Bands[i].FControl.AnchorParallel(akTop, Bands[i].FControlTop, self);
end;
inherited AlignControls(AControl, RemainingClientRect);
end;
procedure TCustomCoolBar.BitmapOrImageListChange(Sender: TObject);
begin
Invalidate;
@ -470,8 +485,9 @@ begin
inc(x, aLeft);
y := aTop+(FVisiBands[i].FHeight-FVisiBands[i].Control.Height) div 2;
FVisiBands[i].Control.Width:=aWidth;
FVisiBands[i].Control.AnchorParallel(akLeft, x-cBorderWidth, self);
FVisiBands[i].Control.AnchorParallel(akTop, y-cBorderWidth, self);
FVisiBands[i].FControlLeft:=x-cBorderWidth;
FVisiBands[i].FControlTop:=y-cBorderWidth;
ReAlign;
end;
x := FVisiBands[i].Width;
inc(aLeft, x);