Commit f620b70d authored by ondrej's avatar ondrej
Browse files

LCL: toolbar: fix endless align/autosize loop. Issue #33575

git-svn-id: trunk@57674 -
parent ff49fa18
......@@ -2278,7 +2278,7 @@ type
function CheckMenuDropdown(Button: TToolButton): Boolean; virtual;
procedure ClickButton(Button: TToolButton); virtual;
procedure CreateWnd; override;
procedure ControlsAligned; override;
procedure AlignControls(AControl: TControl; var RemainingClientRect: TRect); override;
function FindButtonFromAccel(Accel: Word): TToolButton;
procedure FontChanged(Sender: TObject); override;
procedure Loaded; override;
......
......@@ -150,19 +150,23 @@ begin
end;
end;
procedure TToolBar.ControlsAligned;
procedure TToolBar.AlignControls(AControl: TControl;
var RemainingClientRect: TRect);
var
NewWidth, NewHeight: integer;
begin
if tbfPlacingControls in FToolBarFlags then exit;
Include(FToolBarFlags, tbfPlacingControls);
DisableAlign;
try
AdjustClientRect(RemainingClientRect);
if IsVertical then
WrapButtons(Height, NewWidth, NewHeight, False)
else
WrapButtons(Width, NewWidth, NewHeight, False);
finally
Exclude(FToolBarFlags, tbfPlacingControls);
EnableAlign;
end;
end;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment