Personally, I also find MOFormsBuilder>>asLayout a bit mysterious.
A table can be created using two different ways. Open an MOEasel and
doit:
This uses FormsBuilder.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| builder |
builder := MOFormsBuilder new.
builder column; column; row; row; row.
builder x: 1 y: 1 add: (MOLabelShape new text: 'hello').
builder x: 2 y: 1 add: (MOLabelShape new text: 'world').
builder x: 1 y: 2 add: (MOLabelShape new text: 'hello').
builder x: 2 y: 2 add: (MOLabelShape new text: 'world').
builder x: 1 y: 3 add: (MOLabelShape new text: 'hello').
builder x: 2 y: 3 add: (MOLabelShape new text: 'world').
view shape: builder asShape.
view nodes: (1 to: 5).
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
view nodes: (1 to: 5) forEach: [:each|
view nodes: (1 to: 3) forEach: [:each2 |
view shape label.
view nodes: #('hello' 'world').
view horizontalLineLayout.
].
view verticalLineLayout.
]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
or a more elaborated version:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
view shape rectangle withoutBorder.
view nodes: (1 to: 5) forEach: [:each|
view shape rectangle withoutBorder.
view interaction forwarder.
view nodes: (1 to: 3) forEach: [:each2 |
view shape label.
view interaction forwarder.
view nodes: #('hello' 'world').
view horizontalLineLayout gapSize: 0.
].
view verticalLineLayout gapSize: 0.
]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
A similar version with asLayout could be:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| builder |
builder := MOFormsBuilder new.
builder column; column; row; row; row.
builder x: 1 y: 1 add: (view node: #notUsed forIt: [view shape label.
view node: 'hello']).
builder x: 2 y: 1 add: (view node: #notUsed forIt: [view shape label.
view node: 'hello']).
builder x: 1 y: 2 add: (view node: #notUsed forIt: [view shape label.
view node: 'hello']).
builder x: 2 y: 2 add: (view node: #notUsed forIt: [view shape label.
view node: 'hello']).
builder x: 1 y: 3 add: (view node: #notUsed forIt: [view shape label.
view node: 'hello']).
builder x: 2 y: 3 add: (view node: #notUsed forIt: [view shape label.
view node: 'hello']).
view layout: builder asLayout.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Note that these pieces of code are meant to be run in PhaMondrian
Cheers,
Alexandre
On 2 Jul 2009, at 20:21, Simon Denier wrote:
Tu pourrais m'expliquer succinctement le principe
du MOFormsBuilder
asLayout
J'essaie de construire une table avec mais je tatonne a partir des
exemples, c'est chiant.
--
Simon
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.