tappatappa Posted August 25, 2016 Share Posted August 25, 2016 I have defined a few div classes in ServerModule::CustomCSS. When I change (at run time!) the Theme of my application (this can be done in MainModule) I'd wish to switch my Custom CSS, and here is the problem: the CSS is in ServerModule, is global. How do you achieve that? Link to comment Share on other sites More sharing options...
tappatappa Posted August 25, 2016 Author Share Posted August 25, 2016 This may be an ugly workaround but.... In MainForm::AfterConstruction UniSession->AddJS("var my_customstyle = Ext.util.CSS.createStyleSheet('___your__css__here','my_customstyle');"); Link to comment Share on other sites More sharing options...
zilav Posted August 26, 2016 Share Posted August 26, 2016 I think you can also add @import in unigui's theme specific css files. Link to comment Share on other sites More sharing options...
tappatappa Posted August 26, 2016 Author Share Posted August 26, 2016 Thanks zilav for the input, but this would work if I had a css custom file, I guess. Right now I need a way to paste a css string at run time. For now my workaround seems to work, by the way. UnicodeString custom_css; if(UniMainModule()->Theme == UnicodeString(L"neptune")) custom_css = L"neptune_css"; else custom_css = L"default_css"; //removing carriage returns... TReplaceFlags flags = TReplaceFlags() << rfReplaceAll; custom_css = StringReplace(custom_css, L"\r\n", L" ", flags); UniSession->AddJS(UnicodeString("var my_customstyle = Ext.util.CSS.createStyleSheet('")+custom_css+L"','my_customstyle');"); Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now