I tried to consolidate my classes into an example ...
# tornadofx
s
I tried to consolidate my classes into an example to post here. Could anyone explain to me how to use a ViewModel & bindings to update the value of
changeableName
in this example when I hit the "save" button in
RenameFragmentTest
? I must learn!
a
Hey Shan, are you familiar with the TornadoFX gitbook? It might be helpful for quick referencing! https://edvin.gitbooks.io/tornadofx-guide/content/
s
Oh yeah, I have that open at all times! I've read the ViewModel section a few times but unfortunately I'm trying to rewire my brain to think in MVC (coming from a web dev background) and it's taking some time, lol.
a
It definitely will, web dev is really lose & asynchronous naturally while working in statically-typed, synchronous environment is a different animal all together. What might help is understanding that the data in your program may not always reflect the UI itself, so the idea is to create and "deep" and "shallow" copy.
@Shan Here's a project I wrote a while ago that might help you by seeing a fully-working example: https://github.com/Kotlin-Thursdays/Neighborhood-Cat-Scheduler
s
Thank you! I'll check it out 🙂 Structuring this project has been a series of complete rewrites when I read some new best practice or learn something different, lol. Might save me some pain in the future
a
of course! Growing pains and realizing you made mistakes always means you're heading in the right direction. Please let me know if you have any further questions on it - maybe I'll make a blurb about how ModelViews work in TornadoFX (and have the rest of the TFX folk correct whatever I got wrong 😄)