Charlie Heaps 2 Posted September 22 Hi all, I have recently been updating my Delphi/VCL/Windows desktop app to support themes and high DPI. At the same time I finally (only about a decade late) thought I should also try to use the "new" style of message boxes that were introduced in Windows Vista(!). So I've been trying to use the TTaskdialog and its decsendant TAdvTaskDialog components developed by TMS software. I understand that both these components are not actually native to VCL but are wrappers to native Windows dialog boxes. In general, this seems to work well, but I've notice that the components do not support Delphi styles. Rather, they display using whatever is the Current Windows theme. This can look very strange if the app is running in a dark mode and Windows is in a light mode (or vice versa). These issues also seem to apply to the Delphi TFileSaveDialog and possibly a few other components too. I see that developer Rodrigo Ruz has created a great open source set of components called "VCL Styles Utils" that attempt to patch these components to properly follow the Delphi styles: https://github.com/RRUZ/vcl-styles-utils Unfortunately, there seem to be enough problems with these utilities to the point where they are not sufficiently reliable to be usable. For example, certain TTaskdialog options cause buttons in the dialog to disappear or to lose their borders. I'm still developing in Delphi 11.3 but I've seen the problems in Delphi 12.1 also., I have posted about these issues on the above Github forum, but the utilities now see to be more or less unmaintained. So my two questions to you all are: 1. Has anyone else experienced these issues? Have you found workarounds you can share (or just point me in the right direction)? 2. Alternatively, has everyone else moved on to some other UI approach instead of using TTaskdialogs? (I'm painfully aware that I may be trying to develop in a way that now is rather out of date!) Thanks in advance - any suggestions very welcome! Share this post Link to post
pyscripter 694 Posted September 22 (edited) https://quality.embarcadero.com/browse/RSP-41990 See also EtheaDev/StyledComponents: Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations! (github.com). They contain a Task Dialog can be displayed with Vcl Styles (and many others). File dialogs are styled by VCL though. I am not aware of any major issues. Edited September 22 by pyscripter 3 Share this post Link to post
David Heffernan 2353 Posted September 22 VCL styles are still not fit for purpose and probably never will be 1 Share this post Link to post
pyscripter 694 Posted September 22 (edited) 1 hour ago, David Heffernan said: VCL styles are still not fit for purpose and probably never will be Please allow me to disagree. You can produce good-looking flicker-free and DPI-aware applications with recent versions of Delphi. Have you tried PyScripter for instance? The Delphi IDE is also built with VCL Styles. Edited September 22 by pyscripter Share this post Link to post
David Heffernan 2353 Posted September 22 1 hour ago, pyscripter said: Please allow me to disagree. You can produce good-looking flicker-free and DPI-aware applications with recent versions of Delphi. Have you tried PyScripter for instance? The Delphi IDE is also built with VCL Styles. I tried recently and the toolbars still aren't right. Classic example is the behaviour of drop down buttons which open menus in high DPI. Try the file open drop down in, say 250 or 300%. You have to click on the very right hand side of the drop down. Context menus are a mess too. Coming up on the wrong screen. It mostly works, but there's just enough that doesn't for it to be no good. I'd like to offer my clients a dark mode but cannot. Share this post Link to post
pyscripter 694 Posted September 22 (edited) 1 hour ago, David Heffernan said: Classic example is the behaviour of drop down buttons which open menus in high DPI. Try the file open drop down in, say 250 or 300%. You have to click on the very right hand side of the drop down. I am using the Delphi 12 IDE on a 300% display and I am not observing such issues. In PyScripter I am using the SilverpointDev/sptbxlib: SpTBXLib is an expansion package for TB2K Delphi components that adds multiple features including support for styles and custom skins. (github.com) for menus, which I think is still the best Delphi menu components and work really well with VCL styles and Hi-DPI. Edited September 22 by pyscripter Share this post Link to post
Charlie Heaps 2 Posted September 22 16 hours ago, pyscripter said: https://quality.embarcadero.com/browse/RSP-41990 See also EtheaDev/StyledComponents: Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations! (github.com). They contain a Task Dialog can be displayed with Vcl Styles (and many others). File dialogs are styled by VCL though. I am not aware of any major issues. Thanks - that is really helpful! Share this post Link to post
David Heffernan 2353 Posted September 22 3 hours ago, pyscripter said: I am not observing such issues. Maybe they fixed it. My experience has been that every time they fix one bug, there's another one around the corner. Share this post Link to post
Brandon Staggs 285 Posted September 23 On 9/22/2024 at 7:47 AM, David Heffernan said: I'd like to offer my clients a dark mode but cannot. My experience is that they work but require a lot of finagling to get them to work as expected if the application is complex. Most of my projects that use VCL Styles have detours and base classes used to correct behavior. And of course with every update to Delphi these tend to need changes. The worst problem is high DPI which seems like it is just never going to work 100%. I spend time fixing every issue and then have to re-test and re-fix every time they "fix" DPI issues in the VCL. 2 Share this post Link to post
David Heffernan 2353 Posted September 24 FWIW this is what I see with Delphi 11.3, and toolbar drop downs. I'm actually at 175% dpi, and running Delphi DPI aware. If I click on the left hand side of the drop down button next to the open icon, I get a file dialog. If I click on the right hand side of the drop down button I get the menu dropped down. I think that the same happens in my app if I use the VCL menu code, although it's so long since I looked that I don't remember the exact details. I'd be interested to know if the latest versions of Delphi IDE manage to handle this drop down hit detection correctly. Other problems I saw with VCL styles drawing menus was failure to scale check marks in high dpi scenarios. I ended up patching Vcl.Menus so that it uses Windows to draw the menus rather than VCL styles which even for the standard Windows theme is what you get for menus. This was gnarly with high DPI because I need to create and cache PARGB32 bitmaps, because that's how you get alpha blended menu icons in system drawn windows: Themed menu’s icons, a complete Vista and XP solution (updated) - nanoANT Share this post Link to post
Anders Melander 1815 Posted September 24 13 minutes ago, David Heffernan said: FWIW this is what I see with Delphi 11.3, and toolbar drop downs. I'm actually at 175% dpi, and running Delphi DPI aware. Works for me with Delphi 12.1 at 175% Share this post Link to post
David Heffernan 2353 Posted September 24 31 minutes ago, Anders Melander said: Works for me with Delphi 12.1 at 175% Well, good, they fixed that one! Share this post Link to post
Anders Melander 1815 Posted September 24 17 minutes ago, David Heffernan said: Well, good, they fixed that one! I just tried with 11.3 and it works exactly the same. Maybe I'm just not understanding what problem your are experiencing. I'm on Windows 10, BTW. Share this post Link to post
Cristian Peța 107 Posted September 24 22 minutes ago, Anders Melander said: I just tried with 11.3 and it works exactly the same. Maybe I'm just not understanding what problem your are experiencing. I'm on Windows 10, BTW. D 11.3, 150% dpi and it work only if I click the right half of the arrow. The red zone will open the dialog. 1 Share this post Link to post
Anders Melander 1815 Posted September 24 4 minutes ago, Cristian Peța said: D 11.3, 150% dpi and it work only if I click the right half of the arrow. The red zone will open the dialog. Strange. Works for me. Also with 150% What I am seeing though (with 11.3 only), is that if I drop the list by clicking on the left half of the dropdown arrow, and then close the list with another click, then the open dialog is invoked. Dropping the list with a click on the right half works as expected. 1 Share this post Link to post
Cristian Peța 107 Posted September 24 36 minutes ago, Anders Melander said: if I drop the list by clicking on the left half of the dropdown arrow, and then close the list with another click, then the open dialog is invoked My Delphi is in VM with Windows 11. For me the left half will open the list at mouse-down. At mouse-up the open dialog will show. 1 Share this post Link to post
David Heffernan 2353 Posted September 24 Hmm, maybe it's not fixed ..... Share this post Link to post
Anders Melander 1815 Posted September 24 I think Cristian is on 11.3 If someone else, other than me (where it works), could check with 12.2 it would be great. Share this post Link to post
pyscripter 694 Posted September 24 19 minutes ago, Anders Melander said: I think Cristian is on 11.3 If someone else, other than me (where it works), could check with 12.2 it would be great. As mentioned above, 12.2 works correctly at 300%, But maybe there is an issue when running inside a VM. Share this post Link to post
Cristian Peța 107 Posted September 25 On 9/24/2024 at 4:31 PM, pyscripter said: As mentioned above, 12.2 works correctly at 300%, But maybe there is an issue when running inside a VM. Just installed Delphi 12.2 in the same VM as 11.3 with 150% and I can confirm that drop-down works correctly in 12.2. 1 Share this post Link to post