msink / kotlin-libui

Kotlin/Native interop to libui: a portable GUI library
MIT License
650 stars 50 forks source link

Any ways to manually close the window? #25

Open Trumeet opened 5 years ago

Trumeet commented 5 years ago

Hi, I'm using this library to build a desktop project but I need to close the window manually and re-create it later. Now I'm using the ktx library but I cannot find any methods to do this. Are there any methods for me to use in order to close the window? My code is attached below. Thanks.

fun main(args: Array<String>?) {
    appMain() // Display the UI and block
    // To do some extra work.
}

fun appMain() = appWindow(
    title = "Sample",
    width = 320,
    height = 240
) {
    vbox {
        button ("Quit") {
            action {
                // uiControlDestroy
                // I tried it but the window closes without continuing the statements in main().
                this@appWindow.dispose()
            }
        }
    }
}