Ben Coman 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@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev

I've just bumped into one potential downside of labelling elements using composition at the element.  Essentially I am doing a lot of the following for each object in the model ...
---
model := someObject.
outer := ROElement spriteOn: model.
innerChildren := ROElement spriteOn: model.
innerLabel := ROElement labelOn: model.
outer add: innerLabel; add: innerChildren.
---
and then wanting to add edges between elements.  To do this I will need to search the View for the two elements matching model objects that need to be connected.

Using code taken from the Roassal Easel <Find> button as an example...
---
        stack firstView elementsDo: [ :el |
            el isNotEdge ifTrue: [ allModels add: el -> el model printString ] ].
---
I am not clear of the effect on searching the graph that having the three elements inner, innerLabel and outer with the same model will have.

cheers -ben