M.Ammar Posted June 15, 2020 Share Posted June 15, 2020 Hi I use google fonts, and i need to change font family at run time, I managed to do it for all component except for UniTreeMenu, I need like the flowing code which works on UniTabSheet UniSession.AddJS(UniTabSheet.JSName + '.tab.btnInnerEl.setStyle("font-family", "'Cairo'")'); regards Ammar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 15, 2020 Share Posted June 15, 2020 11 minutes ago, M.Ammar said: for all component except for UniTreeMenu Hi, Do you want to use google font for this component too, or..? Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted June 15, 2020 Author Share Posted June 15, 2020 6 minutes ago, Sherzod said: Hi, Do you want to use google font for this component too, or..? yes please, I already can use it by adding a css below .treemenulavender .x-treelist, .treemenulavender .x-treelist-row{ background-color: #10044a; } .treemenulavender .x-treelist-row-over, .treemenulavender .x-treelist-nav .x-treelist-item-selected > .x-treelist-row{ background-color: #40366e !important; } .treemenulavender .x-treelist-item-text, .treemenulavender .x-treelist-item-icon, .treemenulavender .x-treelist-item-expander { color: #e8dff7; font-family: Cairo; font-size: 14px; } what i need is to be able to change it at runtime with some code like this UniSession.AddJS(UniTabSheet.JSName + '.tab.btnInnerEl.setStyle("font-family", "'Cairo'")'); that works with UniTreeMenu regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 15, 2020 Share Posted June 15, 2020 You can find elements with the above selectors and try to change styles. Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted June 15, 2020 Author Share Posted June 15, 2020 13 minutes ago, Sherzod said: You can find elements with the above selectors and try to change styles. Sorry I did not understand what you told, can you give example please. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 15, 2020 Share Posted June 15, 2020 27 minutes ago, M.Ammar said: font-family: Cairo; And what does this font look like, where can I get it? Or do you have a test case? Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted June 15, 2020 Author Share Posted June 15, 2020 5 minutes ago, Sherzod said: And what does this font look like, where can I get it? Or do you have a test case? based on another topic of yours i added this link in server module <link href='https://fonts.googleapis.com/css?family=Cairo' rel='stylesheet'> this is the font https://fonts.google.com/specimen/Cairo?subset=arabic Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 15, 2020 Share Posted June 15, 2020 OK I will try to check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 15, 2020 Share Posted June 15, 2020 6 hours ago, M.Ammar said: what i need is to be able to change it at runtime with some code like this UniSession.AddJS(UniTabSheet.JSName + '.tab.btnInnerEl.setStyle("font-family", "'Cairo'")'); that works with UniTreeMenu Can you try this? procedure TMainForm.UniButton1Click(Sender: TObject); begin UniTreeMenu1.JSInterface.JSCode(#1'.getEl().select(".x-treelist-item-text").setStyle("font-family", "Cairo");'); end; 1 Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted June 16, 2020 Author Share Posted June 16, 2020 this is working perfect if you can direct me to sources to understand jsCode in UniGui it will be great Thank you Quote Link to comment Share on other sites More sharing options...
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.