Login  Register

selective forwarding of ROMenuActivable

Posted by Ben Coman on Oct 01, 2012; 11:13am
URL: https://forum.world.st/selective-forwarding-of-ROMenuActivable-tp4649729.html

Alexandre,

A couple of days ago you showed how to forward only ROMouseDragging on a
composed element while leaving ROLightlyHighlightable on the inner
elements.  I'd like to do the same with menus using ROMenuActivable.  
That is, I want to define one menu for an outer element to activate for
all its inner elements.  I gave it a naive guess by modifying
ROExample>>composingOn:. below.  This works if all are forwarded per
CASE 1, but not per CASE 2.  Is there a different class I should be
forwarding?

cheers -ben

"-------------"
"-------------"
counter := 0.

outter := ROElement new + ROBorder white.
outter @ RODraggable @ ROLightlyHighlightable.

inner := ROElement sprite @ ROLightlyHighlightable.
innerLabel := (ROElement labelOn: 'My sprite') @ ROLightlyHighlightable.

outter add: inner; add: innerLabel.

"We layout the things"
ROVerticalLineLayout on: outter elements.
rawView add: outter.

"CASE 1 forwarding all"
inner forward.
innerLabel forward.


"CASE 2 menu forwarding"
"inner forward: ROMouseDragging.
inner forward: ROMenuActivable .
innerLabel forward: ROMouseDragging.
innerLabel forward: ROMenuActivable .
"

"MENUS"
outter @ (ROMenuActivable new
         item: 'OuterMenu' action:
        [
            :model |
            counter := counter + 1.
            Transcript crShow: 'Outer ', counter asString .
        ] ).
inner @ (ROMenuActivable new
         item: 'InnerMenu' action:
        [
            :model |
            counter := counter + 1.
            Transcript crShow: 'Inner ', counter asString .
        ] ).
innerLabel @ (ROMenuActivable new
         item: 'InnerLabelMenu' action:
        [
            :model |
            counter := counter + 1.
            Transcript crShow: 'InnerLabel ', counter asString .
        ] ).
"-------------"
"-------------"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev