I have 3 Stylebooks on my MainForm that a user can pick from. Once it's set, I Also set the same StyleBook for my other Forms. Most of the Stylebook styles get set properly but I have 1 toolbar that doesn't get set the right color and seems to stay the initial color.
I've already tried 2 ways to set the stylebook.
Method 1:
From the other Forms it self with:
Self.StyleBook := TForm(Application.MainForm).StyleBook;
Method 2:
On creating the other forms in my MainForm.
Form2 := TForm2.Create(nil);
Form2.StyleBook := Self.StyleBook;
Form2.Show;
Both of these methods gave the same result. The only way I've been able to solve this is to actually add the StyleBooks in the designer for the other forms too. But I rather not do that.
Does anyone have a solution for this?
UPDATE: I also noticed that the style color does get set after I rotate my screen.
I've found a solution to my problem.
For the components that don't get the right style I set their stylelookup again in runtime in the FormActivate event.
Don't know why but this solved my style issues. And It needs to be set in FormActivate. I also tried to set it in the FormCreate but that didn't work!