B4J Question 2 tableview 1 css

Kahapdos

Member
Licensed User
Longtime User
good day.
I'am new in css. I have 2 tableviews and when loaded the file css the effect are in the 2 tableviews and I want the only one. Can you helpme please.

B4X:
valida.Initialize("valida", 1600,900)
valida.WindowWidth = fx.PrimaryScreen.MaxX - fx.PrimaryScreen.MinX
valida.WindowLeft = fx.PrimaryScreen.MinX
valida.WindowHeight = fx.PrimaryScreen.MaxY - fx.PrimaryScreen.MinY
valida.WindowTop = fx.PrimaryScreen.MinY
valida.RootPane.LoadLayout("valida") 
valida.Stylesheets.Add(File.GetUri(File.DirAssets, "Main.css"))
valida.Show

B4X:
css
.table-row-cell:odd{
    -fx-background-color:lightblue;
}


.table-row-cell:filled:focused:selected {
    -fx-background-color: red;
    -fx-background-insets: 0, 1, 2;
    -fx-background: -fx-accent;
    -fx-text-fill: -fx-selection-bar-text;
}


.table-cell:selected { 
-fx-font-family: "Segoe UI Semibold";
-fx-text-fill: white;
-fx-background-color: blue; 
}
 

Cableguy

Expert
Licensed User
Longtime User
That's normal css behaviour, use cssutils to style only the desired view
 
Last edited:
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Interesting question - build an example based on the info provided. Took me a while to get around with the CSS file to make this work:

Found out that the class name in the CSS file must have a blank prior CSS style definition. This might be standard CSS styling but was not aware.
See attached example.

upload_2016-3-17_17-5-52.png
 

Attachments

  • B4JHowToTableViewSetStyleClass.zip
    2.8 KB · Views: 340
Upvote 0
Top