Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TAdvedit resizing problem

 Post Reply Post Reply
Author
Verschoor Peter View Drop Down
New Member
New Member
Avatar

Joined: 19 May 2019
Posts: 3
Post Options Post Options   Quote Verschoor Peter Quote  Post ReplyReply Direct Link To This Post Topic: TAdvedit resizing problem
    Posted: 26 May 2019 at 4:19pm
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%
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7779
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2019 at 11:13pm
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?
Back to Top
Verschoor Peter View Drop Down
New Member
New Member
Avatar

Joined: 19 May 2019
Posts: 3
Post Options Post Options   Quote Verschoor Peter Quote  Post ReplyReply Direct Link To This Post Posted: 05 Jul 2019 at 6:26pm
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

Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7779
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jul 2019 at 9:29am
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;
begin
  inherited Loaded;

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

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.
Back to Top
Verschoor Peter View Drop Down
New Member
New Member
Avatar

Joined: 19 May 2019
Posts: 3
Post Options Post Options   Quote Verschoor Peter Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jul 2019 at 2:39pm
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 !
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down