Page 1 of 1

dbTreeView set selected row background color

PostPosted: Thu Apr 19, 2018 8:14 pm
by huber
Hi

I'd like to set in the dbTreeView bean the selected row background color. How can this be accomplished?

Regards,

Re: dbTreeView set selected row background color

PostPosted: Fri Apr 20, 2018 1:30 pm
by Gabi Boros
hi,

in which application type? for web it should work be overriding the CSS used for selection color, in the smart client it uses the color from the active LAF

Re: dbTreeView set selected row background color

PostPosted: Fri Apr 20, 2018 2:32 pm
by huber
Hi Gabi

It's for the Smart Client. As you say, the active LAF background color is used, but I would like to use another one.

BTW, is there still no way to control the space between the start of text and the left side (or the triangle)? And also no possibility to span the selected background color over the whole width of the dbTreeView bean? Yes I know the Smart Client has (unfortunately) no priority at Servoy, but still customers expect to have an attractive UI and years of work gone into Smart Client applications can't easely thrown away.

Gabi Boros wrote:hi,

in which application type? for web it should work be overriding the CSS used for selection color, in the smart client it uses the color from the active LAF


Best regards,

Re: dbTreeView set selected row background color

PostPosted: Fri Apr 20, 2018 3:03 pm
by Gabi Boros
the thing is, the dbtreeview on smart client is actually a wrapper around java's swing tree control, and so, if there is no setting/support for
a desired UI change, we can't do it either (this is related to "no way to control the space between the start of text and the left side / no possibility to span the selected background color over the whole width"),
but the best way is, if you create a case, so we can have a look.
as for the background/foreground, you could try to change the LAF colors on solution open
Code: Select all
   var foregroundColor = new Packages.javax.swing.plaf.ColorUIResource(Packages.java.awt.Color.decode('#00ffff'));
   var backgroundColor = new Packages.javax.swing.plaf.ColorUIResource(Packages.java.awt.Color.decode('#ff0000'));
   var uiDefaults = Packages.javax.swing.UIManager.getDefaults();
   uiDefaults.put("Tree.selectionBackground", backgroundColor);
   uiDefaults.put("Tree.selectionForeground", foregroundColor);

Re: dbTreeView set selected row background color

PostPosted: Fri Apr 20, 2018 3:24 pm
by huber
Thanks for your help, Gabi! And your suggestion of changing the LAF color.

The desire would be to give a bg color to each dbTreeView separatly, see attache screenshot. The main menu tree on the left should use the LAF color, the one on the right should have a light blue.

I will try your hint, thanks. And make a case.
Regards