man, I'm having a ton of trouble with updating a t...
# tornadofx
s
man, I'm having a ton of trouble with updating a text field. I'm just trying to use tornado for a simple visual part of my app (feeding images to opencv and then showing a histogram along with some text. I just want to continually update that text, I don't care if it's in a viewbox or whatever. Current code is extremely messy, but I really don't care. I do care if I'm following best practices (I tried using Property Bindings, but was unable to get that to work either), but really I just want to get a small dumb app working. https://github.com/snowe2010/opencvtest/blob/master/src/main/kotlin/com/tylerthrailkill/testing/main.kt I've tried following the tornadofx-guide repo, but it's quite confusing, especially for someone that isn't sure what they're actually looking for.
s
maybe i'm missing something but so far all you have is a property. you haven't actually made a text field or label component that is bound to the property.
a
off topic: which keyboard? 😛
s
@Spike Baylor yeah I guess I’m confused on how to do that. I’ve read over the section on properties and I don’t see how they actually tie to actual components
@abhinay a custom built crkbd (also known as the corne keyboard) sorry, that’s my other keyboard. the one in my avatar is a planck
s
you'll want to add a textfield or label component and bind your labelProperty to it. something like this
Copy code
textfield(labelProperty) { // stuff if you need it }
also.. maybe you know this but you're definitely doing a LOT of stuff in that root = {} block of code that you should not.
i assume a lot of it is there for testing, like the Thread.sleep and things like that.
s
fantastic, I didn’t realize that’s how you bind the property. That’s exactly what I need. And yeah it’s really shitty code, I refactored a bit of it afterward and yes the thread sleeps were just for testing. Any suggestions are welcome though this isn’t an app to ever be used for anything except myself.
s
that is sort of the shortcut way to bind properties, but it is essentially just calling .bind(labelProperty) on the text field.
s
ah ok. I am developing that app on my home computer so it’ll have to wait till tonight to try it out. thanks for the help!
s
np, good luck
s
that worked! thanks!
s
Awesome