09.04.2018 Views

tornadofx-guide

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Workspaces<br />

The resulting Workspace consists of a button bar with four default buttons and an empty<br />

content area below it. The content area can house any UIComponent . You add a component<br />

to the content area by calling workspace.dock() on it. If you show the Workspace without a<br />

docked View , it will by default only take up the space needed for the buttons. The window<br />

in Figure 16.1 was resized after it was opened.<br />

Let's pretend we have a CustomerList component that we would like to dock in the<br />

Workspace as the application starts. We do this by overriding the onBeforeShow callback:<br />

class MyApp : App(Workspace::class) {<br />

override fun onBeforeShow(view: UIComponent) {<br />

workspace.dock()<br />

}<br />

}<br />

Figure 16.2<br />

226

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!