tappatappa Posted August 25, 2016 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? Quote
tappatappa Posted August 25, 2016 Author 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');"); Quote
zilav Posted August 26, 2016 Posted August 26, 2016 I think you can also add @import in unigui's theme specific css files. Quote
tappatappa Posted August 26, 2016 Author 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');"); 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.