Search code examples
csskotlintornadofx

Tornadofx CSS Seleccted row


I am trying to change the background color selected row and the same for a listview like when I do cell{backgroundColor += Color.BLACK} that works but it removes or atlest makes the selection color black aswell I have tried the below but that dossnt work sadly. Thank you for your time!

val tableView by cssclass()

tableView {
    tableRowCell {
        selected {
            backgroundColor += Color.RED
        }
    }
}

Solution

  • Use the and() function

        tableView {
            tableRowCell {
                and(selected) {
                    backgroundColor += Color.GREEN
                }
            }
        }