1

I am adding the a VCL style into my application but am also giving the users an option to turn this off but I cannot figure out how to do this globally at runtime.

Setting "TStyleManager.AutoDiscoverStyleResources := false" almost works but it pops up with an error message saying "Style {style set} not found" but after dismissing the message does exactly what I want.

This code I would expect to work but does not...

if (not ParamObj.UseDarkStyle) then
begin
  //TStyleManager.AutoDiscoverStyleResources := false;
  TStyleManager.SetStyle(TStyleManager.SystemStyle);
end;

I also tried (originally)

TStyleManager.TrySetStyle('Windows');

but this also does not work.

I have tried this both sides of "Application.Initialize;" with no difference

What am I missing? Thanks in advance, Martin

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Martin
  • 815
  • 8
  • 21
  • 1
    The `TStyleManager.SetStyle(TStyleManager.SystemStyle);` code is correct, the only explanation I can think of is maybe you are not adding the `Vcl.Styles` unit to your project. – RRUZ Nov 13 '12 at 04:56

1 Answers1

1

Found the solution. There was a TStyleManager.TrySetStyle further in the initialization code that I did not notice that was resetting it back to the dark style.

Martin
  • 815
  • 8
  • 21