edvin / tornadofx

Lightweight JavaFX Framework for Kotlin
Apache License 2.0
3.68k stars 272 forks source link

replaceWith breaks Live Views for non-nested views? #191

Closed radicaled closed 8 years ago

radicaled commented 8 years ago

It seems that replaceWith() breaks Live Views if you use it at the most top-level view, because it does not set tornadofx.scene property on the new view.

Now, I might be doing this wrong, because my layout looks like this:

Start View
  +---> (bunch of "welcome to the app" + etc controls here)
Editing View
  +---> (a bunch of knobs and everything)

And I suspect that replaceWith might be expecting a structure like this:

Master View
  +---> Start View
  +---> Editing View

with Master View never to be replaced, ever.

I'm not sure if this is a bug or a feature (can't find much documentation on replaceWith either way).

edvin commented 8 years ago

replaceWith got a giant overhaul in the last release, but there were some bugs with the transitions. A new version will be released shortly, and it would be nice to get a fix for this in there as well. You might be right that the scene property is not set when replacing a top level view. Let me have a look at that and get back to you.

edvin commented 8 years ago

I have committed a fix, but I don't have a test case yet. Can you see if this solves the problem for you or show me the code you're running? Sorry for the lazy response, I have so much on my plate this weekend so I try to be a bit pragmatic :)

radicaled commented 8 years ago

Can you see if this solves the problem

I'll try it this weekend if that's fine. If not, it's not a killer bug -- I just moved everything into a "master" view to work around it for now.

edvin commented 8 years ago

I'd like to have this fixed if it isn't so please let me know how it goes. And try with version 1.5.7-SNAPSHOT if possible :)

radicaled commented 8 years ago

Confirmed working, thanks!