rossh 1 Posted December 30, 2024 I have D12.1 and using Themes to paint dark mode. In my app in debug mode, exe responds to "TStyleManager.TrySetStyle('Windows10 Dark', False);" and I get a properly dark mode app. But I put the build into release mode, and all the TLabel components do not follow the theme - stay in btnFace color and black text. The rest on the exe follows the Theme, but not the labels. Also, the source for the VCL.Themes, cannot be debugged or stop at a breakpoint. Sadly a simple example does work properly, but not a bigger app. All very strange. Share this post Link to post
David Heffernan 2354 Posted December 30, 2024 2 hours ago, rossh said: Sadly a simple example does work properly, but not a bigger app. All very strange. Your job is to gradually remove code from your app until the behaviour is the same as a simple example. Good luck. Share this post Link to post
dwrbudr 8 Posted December 31, 2024 Check your project options for all kind of configurations, Debug, Release, etc. Share this post Link to post
rossh 1 Posted December 31, 2024 Ok. The issue was the placement of the "TStyleManager.TrySetStyle..." call. For proper startup drawing, it needs to be before the Application.CreateForm('xyz...') calls in the dpr file. Why? Well I had it after the CreateForms, and before App.Run, which I think meant it set all the forms to re-draw, before they were even shown.. I know it works OK when the SetStyle... is called from a button with an fully running exe, so why the TLabel troubles? I recall, that TLabel is a special case component, as it doesn't normally have a window handle, and somehow, was not getting redrawn. But with the SetStyle completed even before any TLabel is created, seems to convince it to work. Share this post Link to post