The class ROConstraint has been added. It contains some class methods that you may find
interesting.
Your script can become:
-=-=-=-=-=-=-=
| view outer inner innerLabel |
view := ROView new.
outer := ROElement sprite.
outer @ ROLightlyHighlightable .
inner := ROElement sprite .
innerLabel := ROElement labelOn: 'My sprite'.
outer add: inner; add: innerLabel.
1 to: 5 do: [ :n | inner add: ROElement sprite ].
inner forward: ROMouseDragging.
innerLabel forward: ROMouseDragging.
inner @ ROLightlyHighlightable.
innerLabel @ ROLightlyHighlightable.
"We layout the things"
ROGridLayout on: inner elements.
ROVerticalLineLayout on: outer elements.
ROConstraint stick: innerLabel below: inner. "<<<=== the new line"
view add: outer.
view open.
-=-=-=-=-=-=-=
Does this solve your problem? I have the impression that having constraints may open new
way to compose objects...
Cheers,
Alexandre
On Sep 28, 2012, at 10:42 PM, Ben Coman <btc(a)openInWorld.com> wrote:
Alexandre Bergel wrote:
Upon further consideration of doing this at the
Element level, not sure if this is a bug or just my understanding. One of the things I
liked about using shapes to offset labels is that ROLightlyHighlightable highlighted both
the element and the label when I hovered over either. Referring to example below, if I
add ROLightlyHighlightable to 'inner' or 'innerLabel' then nothing at all
happens when I hover over either. However if I add ROLightlyHighlightable to
'outer' - the blue square displays only around the outside of the 'outer'
element, and no change to the 'inner' and 'innerLabel'.
--------------------------------
| view outter inner innerLabel |
view := ROView new.
outter := ROElement new + ROBorder white.
outter @ RODraggable @ ROLightlyHighlightable .
inner := ROElement sprite .
innerLabel := ROElement labelOn: 'My sprite'.
outter add: inner; add: innerLabel.
inner forward.
innerLabel forward.
"We layout the things"
ROVerticalLineLayout on: outter elements.
view add: outter.
view open
You said: "add ROLightlyHighlightable to 'inner' or 'innerLabel'
then nothing at all happens when I hover over either"
=> This is normal since inner and innerLabel forward all the events. If you want to
have have the highlight on the children element while preserving the drag and dropping of
the compound, then you have the following script:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view outter inner innerLabel |
view := ROView new.
outter := ROElement new + ROBorder white.
outter @ RODraggable @ ROLightlyHighlightable .
inner := ROElement sprite .
innerLabel := ROElement labelOn: 'My sprite'.
outter add: inner; add: innerLabel.
inner forward: ROMouseDragging.
innerLabel forward: ROMouseDragging.
inner @ ROLightlyHighlightable.
innerLabel @ ROLightlyHighlightable.
"We layout the things"
ROVerticalLineLayout on: outter elements.
view add: outter.
view open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Cheers,
Alexandre
Thanks. I'm chuckling quietly to myself how easy that was (when you know
how).
The next thing then is a slight addition to your script as below. My need is that the
label move with the border of the 'inner' node. The initial layout looks fine.
Effectively this is one node that has two bounds - an inner one for its children and an
outer one that encompasses its labels (and perhaps other shapes).
However currently the child nodes can be dragged on top of the label. If you can get
this working then I think the below script would make a good ROExample.
-------------
| view outer inner innerLabel |
view := ROView new.
outer := ROElement sprite.
outer @ ROLightlyHighlightable .
inner := ROElement sprite .
innerLabel := ROElement labelOn: 'My sprite'.
outer add: inner; add: innerLabel.
1 to: 5 do: [ :n | inner add: ROElement sprite ].
inner forward: ROMouseDragging.
innerLabel forward: ROMouseDragging.
inner @ ROLightlyHighlightable.
innerLabel @ ROLightlyHighlightable.
"We layout the things"
ROGridLayout on: inner elements.
ROVerticalLineLayout on: outer elements.
view add: outer.
view open.
-----------------
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.