Views
2 months ago

tornadofx-guide

7. Layouts and Menus

7. Layouts and Menus squeezebox { fold("Customer Editor", expanded = true) { form { fieldset("Customer Details") { field("Name") { textfield() } field("Password") { textfield() } } } } fold("Some other editor", expanded = true) { stackpane { label("Nothing here") } } } Figure 7.17 A Squeezebox showing two folds, both expanded by default You can tell the SqueezeBox to only allow a single fold to be expanded at any given time by passing multiselect = false to the builder constructor. You can optionally allow folds to be closable by clicking a cross in the right corner of the title pane for the fold. You enable the close buttons on a per fold basis by passing closeable = true to the fold builder. 114

7. Layouts and Menus squeezebox { fold("Customer Editor", expanded = true, closeable = true) { form { fieldset("Customer Details") { field("Name") { textfield() } field("Password") { textfield() } } } } fold("Some other editor", closeable = true) { stackpane { label("Nothing here") } } } Figure 7.18 This SqueezeBox has closeable folds The closeable property can of course be combined with expanded . Another important difference between the SqueezeBox and the Accordion is the way it distributes overflowing space. The Accordion will extend vertically to fill its parent container and push any folds below the currently opened ones all the way to the bottom. This creates an unnatural looking view if the parent container is very large. The squeezebox probably does what you want by default in this regard, but you can add fillHeight = true to get a similar look as the Accordion.I 115

Guide
Guide
GUIDE
Guide
Guide
GUIDE
Guide
GUIDE
Guide
GUIDE
GUIDE
GUIDE