Hello. I have just started with Kotlin a month bac...
# tornadofx
m
Hello. I have just started with Kotlin a month back and decided my first project should be in TornadoFX even though I have 0 experience with JavaFX. I have been loving it though. All the issues I faced, I was able to resolve by carefully reading through SO questions and the guide. I am however, now stuck on one issue that I cannot seem to figure out. When I open another view from a listview as follows:
ProjectView().openWindow()
How do I prevent the window close button from working. I tried putting
primaryStage.setOnCloseRequest{}
in the view root but it does not work.
g
try consuming the event
primaryStage.setOnCloseRequest( evt -> evt.consume() )
m
Yes I did try this. I added it to the root element of the ProjectView but I can still close it with the X.
g
A simple example of what you are doing might help to see where you are going wrong
m
Copy code
class ProjectView(projectName: String): View(projectName) {

    override val root = borderpane {
        primaryStage.setOnCloseRequest { event -> event.consume() }
        top(ProjectDetailView::class)
        center(StageList::class)
        bottom(AddStageView::class)
    }

}
This is the view that gets called from the listview as I mentioned. The close event consume is not working here.