简体   繁体   中英

TornadoFX - Problem displaying a modal view with 'openWindow'

When I show a view with openWindow and the Modality.WINDOW_MODAL modifier, the first time this window behaves like a modal window, but if I close the view and open it again, it behaves like a non-modal view (access to the parent view is possible).

What could this behavior be due to?

Thanks very much.

class VentanaPrincipal: View("Ventana principal") {

    private val openModalSinParametros: OpenModalSinParametros by inject()

    override val root = vbox {
        // Posicionar vista principal.
        primaryStage.x = 10.0
        primaryStage.y = 10.0
        setPrefSize(400.0, 400.0)
        alignment = Pos.CENTER
        label {
            font = Font(14.0)
            textFill = Color.NAVY
            text = "ESTA ES LA VENTANA PRINCIPAL"
        }
        button {
            text = "Abrir ventana con 'openWindow' sin parámetros"
            action {
                openWindowSinParametros.openWindow(modality = Modality.WINDOW_MODAL)
            }
        }
    }
}

Either pass modality: Modality = Modality.APPLICATION_MODAL , or simply call openWindowSinParametros.openModal() to get the proper defaults:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM