vpena wrote:
Hello Dennis,
Maybe you can try something like this:
testNodeLabeling
| view rawView nodes node label |
rawView := ROView new.
view := ROMondrianViewBuilder view: rawView.
view shape rectangle withoutBorder.
node := view node: 'example' forIt:[
view shape rectangle size: 100.
view node: 1.
view shape label.
view node: 'test'.
view verticalLineLayout.
].
view noLayout.
view open.
So you have a node that contains 2 nodes, your original node and its label.
With this you can re-arrange any way you like. For example, if you want to
put the label in the top you can do something like this:
nodes := view node: 'example' forIt:[
view shape label.
view node: 'test'.
view shape rectangle size: 100.
view node: 1.
view verticalLineLayout.
].
I hope it helps.
Cheers,
Vanessa.
Depending on Dennis' requirements, the problem with using two elements
is that when node '1' is moved, node 'test' does not move with it.
Guessing from what I can see of the Roassal architecture, it seems
shapes are meant for this purpose to remain in a fixed orientation its
element. The difficulty however with putting a label at the bottom is
that the height of the ChildrenShape is dynamic depending on how you
drag around the inner nodes.
With recent changes I had requested regarding shapes, I envisage
something like the following would work, and you can see the label
positioned correctly but the mouse interaction to drag 'inner2' is not
quite right yet, or I'm doing it wrong:
-----------------
| view outer inner1 inner2 childrenShape labelOffsetShape |
outer := ((ROElement spriteOn: 'outer') + ROLabel ).
inner1 := ((ROElement bare on: 'SN-TestData') @ RODraggable @
ROLightlyHighlightable ). "shapes defined later"
inner2 := ((ROElement spriteOn: 'inner2' ) + ROLabel @
ROLightlyHighlightable ).
childrenShape := ROChildrenShape new.
labelOffsetShape := ROTranslatingShape offset:
[ :el2 |
| offset |
offset := 0 @ (childrenShape boundsFor: el2) extent y negated.
Transcript crShow: offset asString, ' ', el2 model asString.
offset
].
inner1 + ROBorder + childrenShape + labelOffsetShape + ROLabel.
view := (ROView new @ RODraggable) add: (outer add: (inner1 add:
inner2)).
view open.
------------------