Is there a reason why I have to call the `addPseud...
# tornadofx
n
Is there a reason why I have to call the
addPseudoClass
methode with a
String
instead of
addPseudoClass(ApplicationStyle.somePseudoClass)
which works for normal css classes
addClass(ApplicationStyle.someStyle)
? Second question I defined a pseudoClass in my
ApplicationStyle
class and add the pseudoclass with
addPseudoClass
to a
treecell
which should change the background color but nothing happends, this is the code (I shortened it):
Copy code
// In the init methode do addClass(view)
cellFormat {
                        when (it) {
                             is SomeClass -> {
                                addPseudoClass("hasItem")
                                text = it.toString()
                                }
                            else -> {
                                removePseudoClass("hasItem")
                                text = it.toString()
                            }
                        }
               }
And that's the css
Copy code
view {
            treeCell {
                backgroundInsets += box(1.5.px, 0.px, 1.5.px, 0.px)
                fontSize = 12.px

            }
            and(hasItem) {
                backgroundColor += c("#F7F7F7")
            }
        }
r
Sorry I'm a little late to the party. Just a question: Why is
and(hasItem)
not inside the
treeCell
rule?
Copy code
view {
    treeCell {
        backgroundInsets += box(1.5.px, 0.px, 1.5.px, 0.px)
        fontSize = 12.px

        and(hasItem) {
            backgroundColor += c("#F7F7F7")
        }
    }
}
n
That's a good question 😉 ... I guess copy past error