Jump to content

Treeview custom colors


mjcramos

Recommended Posts

Greetings, I'm implementing a unitreeview in an application and would like to customize the colors and some functions, I found here in the forum a topic that almost solved my problem,

 

 UniSession.SetStyle(
    '#' + NavTreeView.JSName + '_id .x-tree-view{'+
    '  background-color: ' + uniColor2Web(NavTreeView.Color) + ';'+
    '}'+
    '#' + NavTreeView.JSName + '_id .x-tree-view .x-grid-cell-inner-treecolumn{'+
    '  background-color: ' + uniColor2Web(NavTreeView.Color) + ';'+
    '  color: ' + uniColor2Web(NavTreeView.Font.Color) +';'+
    '  fontSize:' + uniColor2Web(NavTreeView.Font.Size) +';'+
    '  font: ' + NavTreeView.Font.ToString(False, False, False, False) +';'+
    '}'+
    '#' + NavTreeView.JSName + '_id .x-tree-view Ext.select(ColCells).setStyle("cursor", "pointer");'
  );

 

It was very good, but I would like to move the mouse over the cell it changed the color, same as the original, when applying this code it disabled this function, I am sending an image of the original, the color is white and when I move the mouse over The node becomes dark

post-4361-0-65462000-1482516370_thumb.jpg

post-4361-0-83403300-1482516531_thumb.jpg

Link to comment
Share on other sites

Hello, thanks for the quick reply, it would be kind to hover over the menu and highlight the color of the option that is below the mouse cursor, the normal treeview when passing the mouse does this, however after applying the code of this function it has lost this property I'm using the google translator, sorry for the pronunciation

tree.rar

Link to comment
Share on other sites

Hi,

 

Try this:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniSession.SetStyle(
    '#' + UniTreeView1.JSName + '_id .x-tree-view{'+
    '  background-color: ' + uniColor2Web(UniTreeView1.Color) + ';'+
    '}'+
    '#' + UniTreeView1.JSName + '_id .x-tree-view .x-grid-cell-inner-treecolumn{'+
    '  background-color: ' + uniColor2Web(UniTreeView1.Color) + ';'+
    '  color: ' + uniColor2Web(UniTreeView1.Font.Color) +';'+
    '  fontSize:' + uniColor2Web(UniTreeView1.Font.Size) +';'+
    '  font: ' + UniTreeView1.Font.ToString(False, False, False, False) +';'+
    '}'+
    '#' + UniTreeView1.JSName + '_id .x-tree-view .x-grid-row-selected .x-grid-cell-inner-treecolumn {'+
    '  background-color: ' + uniColor2Web(clLime) + ';'+
    '  color: ' + uniColor2Web(clBlack) +';'+
    '  fontSize:' + uniColor2Web(UniTreeView1.Font.Size) +';'+
    '  font: ' + UniTreeView1.Font.ToString(False, False, False, False) +';'+
    '}'
  );
end;

Best regards.

Link to comment
Share on other sites

  • 6 years later...

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...