TAdvSmoothPopup on a 2 monitor system with different PPI settings

In a 2 monitor system setted with different PPI when the application is dragged from one monitor to the other the TAdvSmoothPopup is not rescaled properly. The TAdvSmoothPopup's glass frame does not scale properly and cuts the content of the Control showed in it.

I attach here a TAdvSmoothPopup.pas where we maded some fix:

  1. The function ScreenPPI refer always to the principal monitor, not at the aplication monitor, and the function DpiScale return always 1 not the DPi of current monitor.
  2. The events MouseLeave, MouseUp, MouseDown, MouseMove, are forced the UpdateWindow, but the dimension of window glass frame are not corret when Scale Factor > 1.
    Please check and review it and insert in the next release.

AdvSmoothPopup.pas (75.4 KB)

I found similar bugs on other TMS controls, i think it's better if you make some test on a 2 monitor system and fix this bug in the entire library of components.

Thank you for letting us know, we've made the necessary changes to the component, but you will still need to set the ParentFont to false of the control that you use. (Otherwise the dpi difference is used twice for the font size, this is due to the way that it was implemented by Embarcadero).

These fixes will be implemented in the following update.

We already have done a lot of improvements regarding per monitor high dpi usage.
So please let us know in what cases specifically you have these errors, so we can investigate and fix them.

Hello Gjalt,
thank you for your reply. We know that ParentFont must be setted to false.
Please send me the .pas with the fix so we can test it and give you our feedback.

I've sent the incremental update of the source code to your private messages.

Update about new TMS VCL UI Pack v. component TAdvSmoothPopup is broken.
See below the different behaviour of the TAdvSmoothPopup when the application is compiled with the last released VCL UI Pack v.

I assume that the left version is with the incremental source update?
What version of Delphi are you currently using?

i putted the stamp of the TMS VCL UI Pack version on top on any form, the left version is the old version of the VCL UI Pack, the right is the new version 10.5.02.
We use Rad Studio 10.3.2

Yes I understand, but I've sent you a new version of the TAdvSmoothPopUp in October, that was implemented in, so I'm wondering if this was with the changed version or not.

the version VCL UI Pack was compiled with the TMS package as is, without any changes or fix.
The problem now isn't related to the 2 monitor system with different PPI setting, the TAdvSmoothPopup component don't work fine at all in the new version.
We installed the new VCL UI Pack 10.5.2 to see if the problem related at 2 monitor system with different PPI setting was definetively solved, but at the first run of the application we must stop any test due to this strange behaviour of the TAdvSmoothPopup component.

This is very strange as I can not reproduce this issue on my system.
Would it be possible to create a sample project, where you notice the behavior for further investigation?

Hi Gjalt,
I've worked a lot to fix your component for our uses, please check my changes and tell me if they can be merged into your codebase.
Now the popup window appears correctly even when the main application form crosses 2 different monitors with different PPIs, the popup window is drawn using the PPI of the monitor which contains more than 50% of the popup form.
Another fix I made is to remove the double drawing of the popup window that was visible when the popup window appears and the application is using themes.
I await your checks and comments.

AdvSmoothPopup.pas (80.2 KB)

I was glad to check the improvements you made to the code, but unfortunately in my case this doesn't fix anything. As I get the following on my screen with your code.

Opening it for the second time:

With our code (the latest version this gives this result:

I Gjalt,
i have discoverd the same problem when the primary monitor is the one with PPI > 96, if the primary monitor has PPI = 96 and the second monitor PPI > 96 all works as expected.
I fix also this bug and return to you.

Hi Gjalt,
attached here a new version of TAdvSmoothPopup.
In this version the size and PPI of the 2 windows TAdvSmoothPopupForm and TAdvSmoothPopupFormPlaceHolder is controlled uniquely by the variable FDPIScale.
The variable FDPIScale is setted only into the 2 procedures:

  • procedure PopupAt(X, Y: Integer; forcePPIofMainForm: boolean = true);
  • procedure PopupAtControl(AControl: TWinControl;
    Direction: TAdvSmoothPopupDirection; forcePPIofMainForm: boolean = true);

As you can see I added also an optional parameter to the procedures, this parameter can be used to control if the popup window must be use the PPI of the MainForm or must be drived by:

  • for the PopupAt: the PPI of the monitor where will be showed
  • for the PopupAtControl: the PPI of the AControl

Please test it, tell me what do you think about and if can be merged on your codebase.

AdvSmoothPopup.pas (80.5 KB)