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
The FormsBuilder is an algorithm for computing the position of a matrix with several constraints on the columns and rows. As such you can use it both to arrange the shapes in a complex shape, or to layout the nodes in a graph.
In particular, the MOFormsBuilder>>asLayout can be used when the nodes do not have the same height and width. Of course, if the nodes have the same size, you can just layout them using regular layouts like grid, vertical, horizontal.
Cheers, Doru
On 3 Jul 2009, at 15:50, Alexandre Bergel wrote:
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 ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"It's not what we do that matters most, it's how we do it."