I ask again because the other link in a thread about this is not working
I have made a 'branding' form where the user may select a theme.
The first thing in notice is that this form does NOT show up in the already selected theme (Sunny).
So i thought i have to set the IWCGJQThemeSwitcher.JQThemeSwitcherOptions.LoadTheme property.
- Code: Select all
IWCGJQThemeSwitcher.JQThemeSwitcherOptions.LoadTheme := IWServerController.ReadSetting('WebTheme', 'INFOmatch-Yellow');
Yes this sets the right theme for the form, however the IWCGJQThemeSwitcher stil shows the wrong theme.
So i thought to use SetTheme to set the theme:
- Code: Select all
IWCGJQThemeSwitcher.SetTheme(IWServerController.ReadSetting('WebTheme', 'INFOmatch-Yellow'));
Yes this set the right value but the forms does not change
So i do both
- Code: Select all
IWCGJQThemeSwitcher.SetTheme(IWServerController.ReadSetting('WebTheme', 'INFOmatch-Yellow'));
IWCGJQThemeSwitcher.JQThemeSwitcherOptions.LoadTheme := IWServerController.ReadSetting('WebTheme', 'INFOmatch-Yellow');
So far so good
Now i have to react on the Select event of the IWCGJQThemeSwitcher
To be sure this event is not called with my first two statements i hook them in after them:
I have added some codesite code to show the AParams property of the IWCGJQThemeSwitcherJQThemeSwitcherOptionsSelect event
- Code: Select all
IWCGJQThemeSwitcher.SetTheme(IWServerController.ReadSetting('WebTheme', 'INFOmatch-Yellow'));
IWCGJQThemeSwitcher.JQThemeSwitcherOptions.LoadTheme := IWServerController.ReadSetting('WebTheme', 'INFOmatch-Yellow');
IWCGJQThemeSwitcher.JQThemeSwitcherOptions.OnSelect.Ajax := True;
IWCGJQThemeSwitcher.JQThemeSwitcherOptions.OnSelect.OnEvent := IWCGJQThemeSwitcherJQThemeSwitcherOptionsSelect;
When i run i see two time's Aparams in codesite, once with jWin8 and once with Sunny as being the value for IWCGJQTHEMESWITCHER_THEME
I did not expect this because i hooked in the event after setting the Theme!
So now i set a Boolean FStarting := True; in the FormCreate and FStarting := False in the IWAppFormAfterRender and in the select event:
- Code: Select all
procedure TIWFormSettingsBranding.IWCGJQThemeSwitcherJQThemeSwitcherOptionsSelect(
Sender: TObject; AParams: TStringList);
begin
if not FStarting then
Codesite.Send('Aparams' , AParams);
lets see what happens?
Still two times the codesite message
What am i missing here?
And what to do if i really do select another Theme?
>I want the current form to show the newly selected theme
Do i need to free al forms in memory or will the take the newly selected automatic, tried this but no, so better free?
Busy for more than 3 hours now on this, simply looking, subject
Any help is appreciated
Eric