Skip to content

Instantly share code, notes, and snippets.

@jschneider
Created November 8, 2017 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jschneider/e864e9273869e0b942057a68182131dd to your computer and use it in GitHub Desktop.
Save jschneider/e864e9273869e0b942057a68182131dd to your computer and use it in GitHub Desktop.
Reproduces the navigation bug
import tornadofx.*
/**
* To reproduce use the navigation drawer to switch the views:
* ## Working as expected:
* * Press: View A
* * Press: View B (borward and back buttons work as expected)
*
* ## Not working as expected:
* * Press: View A
* * Press: View B (forward and back buttons work as expected)
* * Press: View A (forward and back buttons work as expected)
* * Press: View A *again* --> Forward button no longer available
*
* @author Johannes Schneider ([js@cedarsoft.com](mailto:js@cedarsoft.com))
*/
fun main(args: Array<String>) {
launch<WorkspaceSample>()
}
class WorkspaceSample : App(MyWorkspace::class)
class MyWorkspace : Workspace() {
init {
with(leftDrawer) {
item("Navigation", expanded = true) {
label("Hello World")
button("View A") {
action { dock<ViewA>() }
}
button("View B") {
action { dock<ViewB>() }
}
}
}
}
}
class ViewA : View() {
override val root = hbox {
label("View A")
}
}
class ViewB : View() {
override val root = hbox {
label("View B")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment