Login  Register

Re: selective forwarding of ROMenuActivable DISREGARD

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

Please disregard my previous post on this.  I partially solved this
myself, using the the obvious forwarding of ROMouseRightClick rather
than ROMenuActivable.
However when a right-click is forwarded to the outer element, the block
receives :model equal to the 'outer' object rather than the 'inner'
object which was clicked.  I guess I will have to work around this it as
is, with a menu defined on each individual element, but referring to a
common method to return a common menu to all elements.

cheers -ben

Ben Coman wrote:

> 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
>

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