TAdvToolBarButton does not autosize when assigned action caption change

In the recent versions I saw that TAdvToolBarButtons with AutoSize, in a TAdvToolBar, does not resize their width when the assigned action caption changes.

Looking at latest unit code version there is this check that disable auto-sizing:

procedure TAdvCustomToolBarButton.AdjustSize;
var
ImgS, CS, W, H, TH, Scaledoffset, ScaledSpacing: integer;
images: TCustomImageList;
imgidx: Integer;
R: TRect;
ToolBarStyler: TCustomAdvToolBarStyler;
IsAeroVista: Boolean;
scale: single;
begin
if not Assigned(Parent) then
Exit;

{$IFNDEF DELPHIXE15_LVL}
if AutoSize then
{$ENDIF}
{$IFDEF DELPHIXE15_LVL}
if 1 < 0 then
{$ENDIF}
begin
IsAeroVista := Assigned(AdvQuickAccessToolBar) and AdvQuickAccessToolBar.FIsAeroVista and not AdvQuickAccessToolBar.FullSize;
...

I'm on Delphi 12.3 so if 1 < 0 is applied.

To solve I've, at the moment, commented check code and program back to works fine.

Any idea about this check ?

Addressed in TMS VCL UI Pack v13.5.10.0

The if 1 < 0 is still present in latest v13.5.10.1:

procedure TAdvCustomToolBarButton.AdjustSize;
var
ImgS, CS, W, H, TH, Scaledoffset, ScaledSpacing: integer;
images: TCustomImageList;
imgidx: Integer;
R: TRect;
ToolBarStyler: TCustomAdvToolBarStyler;
IsAeroVista: Boolean;
scale: single;
begin
if not Assigned(Parent) then
Exit;

{$IFNDEF DELPHIXE15_LVL}
if AutoSize then
{$ENDIF}
{$IFDEF DELPHIXE15_LVL}
if 1 < 0 then
{$ENDIF}
begin
IsAeroVista := Assigned(AdvQuickAccessToolBar) and AdvQuickAccessToolBar.FIsAeroVista and not AdvQuickAccessToolBar.FullSize;

It has been changed & improved and is ready to be included in v13.5.11.0

1 Like

A last question...

I've updated to 13.5.11 (latest version) but in my products I've always used, as TAdvToolBar container, a classic TPanel and not the TAdvDockPanel, so the AutoSize at language text changes is not performed yet.

It is necessary to change the structure and use TAdvDockPanel ?

At movement I've changed sources from:

if Assigned(Parent.Parent) and (Parent.Parent.ClassName = 'TAdvDockPanel') then
  IsOnDockPanel := true;

to:

if Assigned(Parent.Parent) and ((Parent.Parent.ClassName = 'TAdvDockPanel') or (Parent.Parent.ClassName = 'TPanel')) then
  IsOnDockPanel := true;

I've a lot of TAdvToolBar placed in simple TPanel in all my projects so changes to do will be so much...

Can you provide a test project with which we can reproduce this issue here, as so far, we could not see it here.