Jump to content
Sign in to follow this  
rossh

Vcl.Themes different in debug vs release

Recommended Posts

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
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

Check your project options for all kind of configurations, Debug, Release, etc.

Share this post


Link to post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×