I'm trying to create a form with a user selected style saved to an ini file (JvFormStorage and JVIniFileStorage). The problem I have is if I put my code in the OnCreate it doesn't work, In the OnShow works but I get the error:
"Cannot change Visible in OnShow or OnHide"
even if this is the only code in the OnShow or in a procedure call (Green1 a MenuItem but will convert to combobox choices) I.e.:
Procedure TForm1.ChangeTheme;
begin
if Assigned(TStyleManager.ActiveStyle) then Begin
If (Green1.Checked) and (TStyleManager.ActiveStyle.Name<>'Light Green') then
TStyleManager.TrySetStyle('Light Green') else
... else
TStyleManager.TrySetStyle(fdefaultStyleName);
end;
Also tried:
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Form1.ChangeTheme;
Form1.Show;
Application.Run;
Does work but does flicker from normal windows to 'styled' and would prefer no flicker if possible.
I may well be going around this completely the wrong way. Thanks Paul