Open resuwa opened 3 years ago
I suspect when you're adding your CustEdit
onto the scene graph you are not explicitly putting it into your custom scope.
Something like add(find(CustEdit::class, CustScope()))
should work.
However you should not use scopes to hold anything. Create a ViewModal
and inject that into your views and controllers:
private val myViewModal: MyViewModal by inject()
As a beginner with Tornadofx and Kotlin I am learning with the nice examples from Edvin Syse. Now I tried the Scopes example(Share view state using a custom scope in a TornadoFX Master/Detail app) and get the the error message "java.lang.ClassCastException: tornadofx.Scope cannot be cast to ...MyScope" I am using Intelij IDEA/Gradle 5.3 /Kotlin 1.4.32/TornadoFx 1.7.14/JRE 1.8 Is it a version issue or do I miss something?
`class CustomerModel: ItemViewModel(){
} class CustScope :Scope(){ val model= CustomerModel() val customers = FXCollections.observableArrayList(Customer("a","Frankreich"),
Customer("b","Italien"))
}`
class CustEdit : View("My View") {