B4J Question Applying css stylesheets to CustomListViews

GuyBooth

Active Member
Licensed User
I have 5 clvs. Each one has a unique name (clv1, clv2, c;lv3 etc) is loaded to a tabpane page.
The Tabpane is attached to a main form named dtmm_Main

The main layout is loaded with
B4X:
    MainForm = dtmm_mainform
     'Load the main layout file
    MainForm.RootPane.LoadLayout("dtmm_main")
    ' Show
    MainForm.Show
    ' Load css stylesheets
    dtmm_mainform.Stylesheets.Add(File.GetUri(File.DirAssets, "scrollbars.css"))
The style sheet changes the color and style of the scrollbars of all 5 clvs. The stylesheet looks like this:
B4X:
.scroll-bar:vertical .track{
    -fx-background-color: blue;
    -fx-border-color: blue;
}
.scroll-bar:vertical .thumb {
    -fx-background-color: green;
}
This works, but it makes all the scrollbars look the same, and for each CLV I actually want a different color.
In a previous use of stylesheets I was able to assign an ID to each instance of a table, but when I try to do the same thing with the clvs I find the clvs do not have an ID property. Nor do the tabpages.
If I were able to do this, my css would look like this:
B4X:
#clv1 .scroll-bar:vertical .track{
    -fx-background-color: blue;
    -fx-border-color: blue;
}
#clv1 .scroll-bar:vertical .thumb {
    -fx-background-color: green;
}
#clv2 .scroll-bar:vertical .track{
    -fx-background-color: black;
    -fx-border-color: black;
}
#clv2 .scroll-bar:vertical .thumb {
    -fx-background-color: blue;
}
#clv3 .scroll-bar:vertical .track{
    -fx-background-color: red;
    -fx-border-color: red;
}
#clv3 .scroll-bar:vertical .thumb {
    -fx-background-color: black;
}
#clv4 .scroll-bar:vertical .track{
    -fx-background-color: yellow;
    -fx-border-color: yellow;
}
#clv4 .scroll-bar:vertical .thumb {
    -fx-background-color: grey;
}
#clv5 .scroll-bar:vertical .track{
    -fx-background-color: white;
    -fx-border-color: white;
}
#clv5 .scroll-bar:vertical .thumb {
    -fx-background-color: magenta;
}
But I need to be able to assign a different ID to each clv.
Is there any way to do this?
 

Enrique Gonzalez R

Well-Known Member
Licensed User
Clv may not have an ID but an underlying node might.

Try scenic view to find which is the one you need
 
Top