Hi, I am creating simple form like <this>, but I c...
# tornadofx
o
Hi, I am creating simple form like this, but I can't find how to create an input to upload a file. Could you point me to some example? Thanks.
This thread helps me. Thanks.
k
Copy code
class MainView : View("Hello TornadoFX") {
    private var txt:TextField by singleAssign()
   private val extensions = arrayOf(FileChooser.ExtensionFilter("Image files(*.jpg,*.png)", "*jpg", "*png"))
    var fileChooser = listOf<File>()
    override val root = form{

        fieldset("Choose file"){
            field("FileChooser"){
                txt = textfield()
                button ("Select image"){
                    action {
                       fileChooser =  chooseFile("ggg", extensions,null, FileChooserMode.Single)
                        txt.text = fileChooser.first().absolutePath
                    }
                }


            }
        }
    }
}
👍 1