CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Run time changing

by etwoss » 25 Apr 2014 15:16

Hi


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
You do not have the required permissions to view the files attached to this post.
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 25 Apr 2014 15:31

Hi Eric

Themeswitcher works with cookies, and you must use the onselect even at the first time to know what is saved in themeswitcher cookie.

This happens now because it wasnt the user who selected the theme he wanted, it was you.

So for replicate the site use, you must clear cookies first, have a initial theme the you also set in options.LoadTheme

then when you open that page where the user can chagne the theme, you use onselect to save it for future use.

And yes, all the pages in memory won't get the theme, since the pages in memory don't use themeswitcher, you must warn you users that only next time they will see the next theme.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 28 Apr 2014 14:00

Hi

I have it working now, but i noticed the following:

Chrome: when i open my setting form the themeswitcher show the correct theme from the cookie

IE11 : when i open my setting form the themeswitcher always shows Start

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 29 Apr 2014 11:27

Hi

I understand that each browser has its own cookies so IE does not read the one created when running Chrome, right?

Eruc
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Alexander Bulei » 29 Apr 2014 11:29

Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by etwoss » 29 Apr 2014 11:35

Hi

The property 'LoadTheme' can not be one of the 'AdditionalThemes', they are not in the list.
Can this be made possible?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 29 Apr 2014 11:42

Hi Eric

Can you please detail / explain this?

The property 'LoadTheme' can not be one of the 'AdditionalThemes', they are not in the list.


t.i.a.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 29 Apr 2014 11:46

Hi

The ThemeSwitcher has a property called "LoadTheme", by default its value is "Start"
if i clean all cookies i see the swither coming with this theme as being the default
We have our own themes which we added to the property "AdditionalThemes"
So i hoped that if we can set our own theme in the property LoadTheme it wil use ours as the default to show if there is no cookie
However if you open the property list, the ones from the "AdditionalThemes" are not in the list


Added:

I changed the value for the property not from the property inspector but in the DFM, this hack works but is not so nice


Eric
Last edited by etwoss on 29 Apr 2014 11:56, edited 1 time in total.
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 29 Apr 2014 11:47

Hi

I named the cookie "INFOmatchCookie" and set CookiePath to the path the exe is in
However i can't find the file, searched whole HD, also set ShowHidden files to true

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 29 Apr 2014 11:52

Eric

In this case, a Cookie is temp file, you must clear the cookies in browser developer tools (F12).

And you don't have to set CookiePath.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

Next

Return to JQThemeSwitcher

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.