Jump to content

UniTreeMenu changing font at runtime


M.Ammar

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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;

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...