Page 1 of 1

Dynamic Use / Download Themes

Posted: Tue Feb 06, 2024 10:56 am
by mark.civ
Not sure if this can be achieved but say I have say 5 styles defined for a web application where any particular user will only ever use 1 style, is it possible to dynamically use styles so that only one would get downloaded to the browser instead of all 5 which seems to be the case? It seems inefficient to have to download them all in this case.

Re: Dynamic Use / Download Themes

Posted: Thu Feb 15, 2024 7:55 pm
by René Houba
Hi Mark,

Can you explain a little bit more...

So this is VL Web, because you use Themes.

You created 5 Themes that can be used in total.
How have you defined that one user for example is connected to one of these Themes?

Re: Dynamic Use / Download Themes

Posted: Fri Feb 16, 2024 2:47 pm
by BrendanB
Mark/Rene,

in theory, you could use the following method (pass it the 9-character identifier of your theme) and it would only load when you call this method.

the downside to using this is: At Present time (Feb 2024) there is a bug meaning that this works the first call, but a subsequent call will crash your client (ie. the browser program). So if you are just wanting to set the users chosen theme (from 5 or more), then this should work.

Code: Select all

Mthroutine Name(ChangeTheme)
Define_Map For(*INPUT) Class(#Prim_alph) Name(#ThemeIdentifier)

Set_Ref Com(#SYS_WEB.WebPage.Theme) To(*CREATE_FROM #ThemeIdentifier)

Endroutine
It will fail if you wish to allow them to 'change themes' -- in this case you are better off defining the theme change in the usual manner:

Code: Select all

case of (#ThemeIdentifier)

when(= 1)
#SYS_WEB.WebPage.Theme <= #myTheme1
when= 2)
#SYS_WEB.WebPage.Theme <= #myTheme2

endcase
As you noted, the second block downloads all the themes.

B.