How to dispatch mouseWheel?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to dispatch mouseWheel?

Martin Drautzburg
Hello all,

I've been happily using #handlesMouseWheel: and #mouseWheel until I had to
"ousource" parts of my Morph to a Submorph for layout reasons. The part which
shall respond to mouseWheel is no longer the Morph itself but a Submorph
thereof.

Of course this Submorph does not respond to mouseWheel, because all the wheely
stuff is defined at class level in its owner's class. So I thought I could
just tell this stupid little Moph to let its owner handle the mouse stuff. But
there does not seem to be a way to use on:send:to with mouseWheel.

Is there a way around this problem. Or is there another way to "just do
layout" whithout interfering with the event handling?
       
--
Martin

Reply | Threaded
Open this post in threaded view
|

Re: How to dispatch mouseWheel?

Martin Drautzburg
On Saturday, 5. May 2012 19:06:38 Martin Drautzburg wrote:
Sorry, that was a bit fuzzy.

My Morph is in a GeneralScrollPane. The GeneralScrollPane first sends
mouseWheel event to the scroller (my Morph). My Morph can scroll horizonally
infinitely and handles the horizontal scrolling itself. Its mouseWheel method
makes sure this only happens when the mouse is over it. Otherwise the event
remains unhandled and the GeneralScrollPane handles it and scrolls vertically.

Now I have another Morph (really just a plain Morph) in betwen. The scroller
again sends it a mouseWheel, but its just a plain Morph and it does not handle
it. The effect is that scrolling is always controlled by the scroll pane (i.e.
vertically). I cannot seem to tell the scroll pane: don't ask your scroller,
ask my Morph, nor can I tell this plain Morph: when someone asks you to handle
a mouseWheel, don't just say no, ask my Morph instead.

Of course I can just create another Morph Class which passes all events to its
owner. Is there anything more elegant?

--
Martin

Reply | Threaded
Open this post in threaded view
|

Re: How to dispatch mouseWheel?

Gary Chambers-4
Hi,

Ideally we need to change EventHandler to support mouseWheel events and at
the same time,
perhaps, integrate EventHandlerPlus upwards too.

Otherwise, you will need to do as you suggested, make a Morph subclass
to handle stuff and use that as the in-betweener.

Regards, Gary

----- Original Message -----
From: "Martin Drautzburg" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, May 05, 2012 7:49 PM
Subject: Re: [Pharo-project] How to dispatch mouseWheel?


> On Saturday, 5. May 2012 19:06:38 Martin Drautzburg wrote:
> Sorry, that was a bit fuzzy.
>
> My Morph is in a GeneralScrollPane. The GeneralScrollPane first sends
> mouseWheel event to the scroller (my Morph). My Morph can scroll
> horizonally
> infinitely and handles the horizontal scrolling itself. Its mouseWheel
> method
> makes sure this only happens when the mouse is over it. Otherwise the
> event
> remains unhandled and the GeneralScrollPane handles it and scrolls
> vertically.
>
> Now I have another Morph (really just a plain Morph) in betwen. The
> scroller
> again sends it a mouseWheel, but its just a plain Morph and it does not
> handle
> it. The effect is that scrolling is always controlled by the scroll pane
> (i.e.
> vertically). I cannot seem to tell the scroll pane: don't ask your
> scroller,
> ask my Morph, nor can I tell this plain Morph: when someone asks you to
> handle
> a mouseWheel, don't just say no, ask my Morph instead.
>
> Of course I can just create another Morph Class which passes all events to
> its
> owner. Is there anything more elegant?
>
> --
> Martin
>