我有一个非常简单的任务,但是做不到。
我有Kotlin | Tornadofx应用程序。
我打开fxml屏幕:
class MainView : View() {
override val root : VBox by fxml("/Screen 1.fxml")
}
Screen1.fxml中有一个按钮。我需要该应用打开在Screen1.fxml中按下的按钮上的另一个屏幕(Screen2.fxml)。
我被这个卡住了。通过onaction =“#FunctiondefinedinmainView”从Screen1.fxml仅提供函数调用。但是只能通过
使用MainView交换视图button("Go to Screen2") {
action {
replaceWith<Screen2>()
}
构造,我无法完成,因为我只能从Screen1.fxml中调用一个函数。而且MainView中没有按钮。
谢谢。