Dynamic Use / Download Themes

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
mark.civ
Posts: 8
Joined: Wed Jan 27, 2021 11:34 pm

Dynamic Use / Download Themes

Post 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.
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: Dynamic Use / Download Themes

Post 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?
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: Dynamic Use / Download Themes

Post 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.
Post Reply