3

Using Delphi 2010 I have customized a TSaveDialog using the resource template approach as shown in TOpenPictureDialog in Delpi's ExtDlgs. The template approach allows me to successfully insert a form containing several controls in the system save dialog. This works fine as long as the Windows DPI setting is 96. With user defined (text) scaling or hdpi monitors the inserted form is only partly visible. This is of course due to Form.Scaled = True which causes the form plus containing controls to scale (become larger). Currently the template file ( the default as used in for example TOpenPictureDialog ) contains fixed size dialog and static text elements that define the space that will be taken up by the inserted form.

I can think of several workarounds:

  • No form scaling (not really a solution for hdpi monitors)
  • Provide different templates based on Screen.PixelsPerInch/96: 100% 125%, 150% 200% etc).
  • Using the IFileDialogCustomize interface, but that's not really expressive enough for what I want.

The best solution would probably be a way to resize that template (based on Screen.PixelsPerInch/ 96) in memory before it gets loaded by the dialog. Is something like that available?

Gerrit Beuze
  • 903
  • 2
  • 10
  • 26
  • This does not ring true. Dialog resources use a unit system that is relative to the system font. It should respect scaling. I don't see that the Scaled property is relevant, the dialog is a system dialog and not a Delphi form. Finally, the IFileDialogCustomization mechanism allows you to avoid presenting the user with those awful 15 year old xp legacy dialogs. – David Heffernan Mar 07 '18 at 13:07
  • 1
    It is not the system dialog that does not scale: it is the custom Delphi form that gets inserted that does not fit in the space created by the template. Without Scaled=True the form does not size and fits OK. As said: IFileDialogCustomization does not work for me (XP support for one) – Gerrit Beuze Mar 07 '18 at 14:42
  • Back in the bad old days when I had to support XP I used the template for XP, and IFileDialogCustomization for Vista+. Then I wasn't inflicting the dire legacy dialogs on all my users. If I were you I would not attempt to stuff a Delphi form in there. Use the dialog resource the way it is intended. If you simply must have non standard controls, then build the entire file dialog in Delphi. It's not as if your current solution uses the native file dialogs. You are using the legacy dialogs. A pure Delphi file dialog would probably be less jarring than they are. – David Heffernan Mar 07 '18 at 15:26

0 Answers0