What is a subcanvas?A subcanvas is a container with bounds and other properties used to hold other UI objects. It has no real aspect or value, but can pull a window spec from an ApplicationModel and display it. | ||||||||||
The basicsProperties
AspectmainCanvas ^nil asValue. All the aspect returns is a ValueHolder on nil, which theoretically, does nothing. Why? Doesn’t matter. | ||||||||||
Pulling an existing subcanvasIf you have a subcanvas installed on a window spec, you can pull it out of that ApplicationModel at runtime. To do this, you need to access the named components of its builder. subcanvas := (
| ||||||||||
Changing the spec of a subcanvasThere are three ways to rebuild the subcanvas with another spec and client application. subcanvas client: anApplicationModel. subcanvas client: anApplicationModel spec: aFullSpec. subcanvas client: anApplicationModel spec: aFullSpec builder: aBuilder All three methods work the same way, and the only things you really need are the client and spec. If you don’t specify a spec, it will use the default spec of the client. If you look at the code generated by the Painter Tool, you’ll notice that all it is is an array of component specs. We’re going to use that message and build a full spec out of it. spec := UISpecification from:
In this case, spec := UISpecification from: | ||||||||||
Creating a subcanvas through codeTo create subcanvas, you need to create a SubCanvasSpec. To do so you’ll need to set up its position, client, spec, and then use a builder to create the subcanvas itself. First we set up the layout: aLayoutFrame := LayoutFrame leftOffset:
Set up the basis of the canvas spec: canvasSpec := UI.SubCanvasSpec layout:
And finally to build it and display it: subBuilder := In order to apply the theme of the current application, we need to use the current application’s builder. | ||||||||||
Example
|