What can be provided, is a kind of proxy for the event, like this, you have a chance to
modify the event (and set it to the right model) before it gets passed to the owner.
Something like
element forward: ROMouseClick butBeforeDo: [ :event | event element: element ].
I have done nothing so far. Let me know if this is still a problem.
Cheers,
Alexandre
On Oct 1, 2012, at 8:43 AM, Ben Coman <btc(a)openInWorld.com> wrote:
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
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
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
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.