 |
 |
QotD |
"To be or not to be" – Shakespeare
|
|
        |
 |
Model buildWindowWith: builder specs: specs
Last updated at 6:50 am UTC on 6 July 2018
The method #buildWindowWith:specs: is the main method used in the ToolBuilder framework to build tools.
buildWindowWith: builder specs: specs
| windowSpec |
windowSpec := self buildWindowWith: builder.
specs do:[:assoc|
| rect action widgetSpec |
rect := assoc key.
action := assoc value.
widgetSpec := action value.
widgetSpec ifNotNil:[
widgetSpec frame: rect.
windowSpec children add: widgetSpec]].
^windowSpec
You can see these tools if you look for this method in a browser and then ask for the senders of #buildWindowWith:specs:
A simple example
One particularly simple call is from StringHolder
buildWith: builder
| windowSpec |
windowSpec := self buildWindowWith: builder specs: {
(0@0corner: 1@1) -> [self buildCodePaneWith: builder].
}.
^builder build: windowSpec
The spec object is just
{
(0@0corner: 1@1) -> [self buildCodePaneWith: builder].
}
An association with a block.
In StringHolder this method is called indirectly with
^ToolBuilder open: self label: aString
The result happens to be the well-known Workspace.
For a slightly different way of building a tool see TranscriptStream