TAdvedit resizing problem

TAdvEdit keeps expanding in height

Steps to reproduce :

New project

Put a TAdvedit on the form

Give it a heigth of say 52

set autosize false

run => runtime size is different from design

Now save project

close project

reopen project

TAdvedit expanded vertically ... , and keeps expanding after each save and reload...

BTW I have dpi on 150%

What Delphi version is this?

Is this the latest version of TAdvEdit?
I could not reproduce such problem here. Also, with respect to height & autosize handling, TAdvEdit should behave idential to TEdit. Did you compare with the standard VCL TEdit?

It has been a while but the problem is still there so i investigated a little further :

so i found in :

procedure TCustomAdvEdit.Loaded;

Height := Round(FLoadedHeight) * CalculateDPIScale(Self));

which led me to :

if FDPI <> 96 then

      Result := FontHeightAtDpi(FDPI, 9) / FontHeightAtDpi(96, 9);

Which let to Result = 1.57 (exactly the resizing rate)

Changing 96 to 144 (my pixels per inch) one problem solved.

What didn't solve was when Advedit.autosize = false, next View form as text (all heights are listed ok) , but when return with view as form the height resizing still occured...   

Couldn't find the source of that one.

By the way : AdvMaskedit (in the same unit) didn't show that problem.

Any Ideas ?

Thank you

I can only suspect there is an issue with getting the parent form of the TAdvEdit control at design-time. Is there something special about the form on which you use TAdvEdit as with a new Delphi project that has a new regular TForm, I cannot see a problem here.

However, inspecting & reflecting on the code, it will be better to change the .Loaded to:

procedure TCustomAdvEdit.Loaded;
  inherited Loaded;

  if not (csDesigning in ComponentState) then
    Height := Round(FLoadedHeight * CalculateDPIScale(Self));
    SetBounds(Left, Top, Width, Height);

Can you try with these changes? Fwiw, it will be needed to recompile the TMS Component Pack packages to see the effect at design-time.

Given, I tested only with a single AdvEdit and a regular Edit on a small form, delphi XE4, with desktop on DPI 144.

Tried your solution (including rebuilding the BPL) and indeed solved the problem with form switching to text and back !

(Obviously simple actually now i see it, but still learnt some new things on the way how components mechanics work :))

Anyway problem solved, case closed.

Again, many thanks for your excellent support !