How to create a standalone app

Creating a standalone app based on Glamorous Toolkit is as simple as opening an application specific window and closing the existing GT window. This can be achieved in just a few steps.

Open a basic space with a scene

BlSpace is responsible for displaying a scene in a separate window. Users can customise window's title or extent. To spawn a window send BlSpace>>#show show "Open me in a window and show it to the user" "delegate showing work to the Universe" (BlParallelUniverse forHost: self host class) openSpace: self to an instance of the space.
aSpace := BlSpace new
		addChild: GtCreateStandaloneAppHowToGuide new helloWorldScene;
		extent: 800@600;
		title: 'Hello World'.
aSpace show

Cleaning up the existing windows

The Glamorous Toolkit comes with a GtWorld opened by default. When creating a standalone app based on GT we should close that window, which can be done in two steps.

Disable shutdown-on-close listener

In order to shutdown the process when a window is closed, we add a BlSpaceShutdownOnCloseListener as an event handler to a BlSpace . It should be removed before we close such spaces.
GtWorld allInstances do: [ :eachWorld | eachWorld removeShutdownListener ]

Closing an existing GtWorld

To close an opened window, it is enough to just send BlSpace>>#close close "Delegate closing work to the Universe" (BlParallelUniverse forHost: self host class) closeSpace: self to an intended space.
GtWorld allInstances do: [ :eachWorld | eachWorld close ]

Save the image

Once the intended application window is opened and there are no more GT windows we can save the image (without quitting):
Smalltalk snapshot: true andQuit: false