purring pigeon
purring pigeon

Reputation: 4209

How to style checkbox mark with cell selection enabled

I am having an issue I can't seem to find the correct CSS to correct. When I use the checkbox table cell and and select the row the checkbox mark goes white - looking like it's deselected.

enter image description here

I was able to change my CSS so that this appears the same either selected or not.

.table-row-cell:selected > .check-box-table-cell > .check-box:selected > .box > .mark {
    -fx-background-color: -fx-text-base-color;
    -fx-background-insets: 0;
}

enter image description here

However if that table switches to Cell Selection - then this CSS doesn't work.

enter image description here

I have tried to change adding this as a style:

.table-cell:selected > .check-box-table-cell > .check-box:selected > .box > .mark {
    -fx-background-color: -fx-text-base-color;
    -fx-background-insets: 0;
}

But that leaves me with the same styling as noted above. Not sure how to keep that checkbox from going whited while cell selection is true.

Appreciate any help you can provide.

Thanks.

Upvotes: 0

Views: 857

Answers (1)

J. Doe
J. Doe

Reputation: 46

Using your css code I couldn't exactly reproduce your pictures, since your posted css only changes the appearance of the mark and you probably have extra css code changing the appearance of the check-box, but the problem seems to lie in the css referencing.

.table-cell:selected already refers to the check-box-table-cell, so try

.table-cell:selected > .check-box:selected > .box > .mark{
    -fx-background-color: -fx-text-base-color;
    -fx-background-insets: 0;
}

or

.check-box-table-cell:selected > .check-box:selected > .box > .mark{
    -fx-background-color: -fx-text-base-color;
    -fx-background-insets: 0;
}

Upvotes: 1

Related Questions