In this tutorial we will see how to change the theme of applications dynamically, using the macro sc_set_theme (). As we know, to statically change the theme, just open the application in Scriptcase, go to the Layout menu and choose the side view option.
A screen in which you have the option of choosing the theme of the application logo above a preview of it will be shown. It is also possible to change the model of the Header and Footer (figure) for any model that best apply to your needs. (See pictures below)
However, we are restricted in this way as the customization of these topics in real time. Therefore, the Scriptcase has a macro sc_set_theme (), which lets you change the theme of applications at runtime.
For this example, we will use the following situation: Whenever the user "admin" is logged in the system, this will show the application of customer base with the subject "ScriptCase7_Black". Any other user who is logged in, you see the same application with the theme "ScriptCase7_Blue". To get this effect, see the code that we use in the application event onApplicationInit:
Overview admin user in the form of Customers:
Vision of an any user: