mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 19:18:19 +02:00
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:
parent
a3cf4354b2
commit
978eda5ac9
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user