tappatappa Posted September 30, 2015 Posted September 30, 2015 In MegaDemo procedure TMainForm.ThemeClick(Sender: TObject); begin if UniApplication<>nil then begin UniServerModule.Lock; try case TComponent(Sender).Tag of 1 : UniServerModule.CurrentTheme:='blue'; 2 : UniServerModule.CurrentTheme:='gray'; 3 : UniServerModule.CurrentTheme:='classic'; 4 : UniServerModule.CurrentTheme:='xp'; 5 : UniServerModule.CurrentTheme:='vista'; end; finally UniServerModule.UnLock; end; TUniGUIApplication(UniApplication).Restart; end; end; Is it possible to implement a similar feature without changing UniServerModule and restarting the Application? Quote
ZigZig Posted September 30, 2015 Posted September 30, 2015 Hi, You can use swapStyleSheet function. Try something like this (used to work in old versions of uniGUI, not tested in newer versions) : UniSession.AddJS('Ext.util.CSS.swapStyleSheet(''/ext-4.2.1.883/resources/css/ext-all-gray.css'',''/ext-4.2.1.883/resources/css/ext-all.css'');'); UniSession.AddJS('Ext.util.CSS.swapStyleSheet(''/ext-4.2.1.883/resources/ext-theme-gray/ext-theme-gray-all.css'',''/ext-4.2.1.883/resources/ext-theme-classic/ext-theme-classic-all.css'');'); UniSession.AddJS('Ext.util.CSS.swapStyleSheet(''/uni-0.94.0.1024/css/uni-xtheme-gray.css'',''/uni-0.94.0.1024/css/uni-xtheme-blue.css'');'); UniSession.AddJS('Ext.util.CSS.swapStyleSheet(''/myApplication.dll/ext-4.2.1.883/resources/css/ext-all-gray.css'',''/myApplication.dll/ext-4.2.1.883/resources/css/ext-all.css'');'); UniSession.AddJS('Ext.util.CSS.swapStyleSheet(''/myApplication.dll/ext-4.2.1.883/resources/ext-theme-gray/ext-theme-gray-all.css'',''/myApplication.dll/ext-4.2.1.883/resources/ext-theme-classic/ext-theme-classic-all.css'');'); UniSession.AddJS('Ext.util.CSS.swapStyleSheet(''/myApplication.dll/ext-4.2.1.883/uni-0.94.0.1024/css/uni-xtheme-gray.css'',''/myApplication.dll/ext-4.2.1.883/uni-0.94.0.1024/css/uni-xtheme-blue.css'');'); UniSession.AddJS('Ext.util.CSS.swapStyleSheet(''/myApplication.dll/uni-0.94.0.1024/css/uni-xtheme-gray.css'',''/myApplication.dll/uni-0.94.0.1024/css/uni-xtheme-blue.css'');'); You'll need to adapt the code with newest ExtJS Path, uniGUI Path, dll name and the name of the theme you want to use. Quote
ZigZig Posted October 2, 2015 Posted October 2, 2015 Hi Nefasto Cipa, Was it helpful? Does this trick still work? Quote
tappatappa Posted October 2, 2015 Author Posted October 2, 2015 Hello ZigZig, I am trying. Is not remotely as easy as I hoped Moreover, I guess I have to make it more flexible by retrieving the uniGUI/extjs version from ServerModule. How do I have to change the path in Stand Alone Server mode (I see you refer to the dll in the paths)? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.