Trial and error :slightly_smiling_face: The `vbox`...
# tornadofx
a
Trial and error 🙂 The
vbox
class has a method named getChildList() which returns a mutable list of the element in the vbox. You can remove and add to this lists using
removeAt(i)
and
add (i, NewContent)
. In your case
i
is likely to be 1, but you may have to experiment a bit. Print out the contents of the different element as you're testing to figure out exactly what you need to modify.
n
Of course, getChildList! I didn't think about that! Sorry for the silly question but I'm still learning both Kotlin an TornadoFX, there are lots of methods for someone coming from Python! 😂 Thanks a lot anyway, you're the best!
a
No problem. Glad I could help. I just started to learn myself back in April. A bit of a learning curve but once you get the basic concepts it's really powerful.
n
True, I'm coming from Python because when I started I found on the internet that it was the easiest programming language, but after a while I started seeing too many limits to be honest. Once you've learned some basics Kotlin seems great, it covers so many areas, and TornadoFX looks and feels great compared to Python libs.
s
@Nicola Looks like your use-case would be better served by using a Workspace. https://edvin.gitbooks.io/tornadofx-guide/content/part2/Workspaces.html
n
@Samkeene It could definetely be a solution too, I didn't know this either. Sorry for the lack of experience but writing this program to me is actually an excuse to learn TornadoFX 😂 My program is going to have a lot of personalized menus though, is Workspace as "manageable" as creating a menu from scratch?
s
I think the workspace abstracts enough of that away for it to be the best choice. Behind the scenes the workspace is a BorderPane that controls what is displayed in the left, right, bottom and top depending on the center (docked) component. Have a go and if you have any questions to ask me here.
n
Thanks a lot, I'm going to try it as soon as I get home!