Scrolling a ScrollingDecorator

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

Scrolling a ScrollingDecorator

Ian Bartholomew-18
I noticed some methods in ScrollingDecorator that _seem_ to imply that
scrolling this view using the mouse wheel should work "out of the box".
I couldn't seem to get this to work - am I missing something obvious?

 From a (non exhaustive) play it seems that the only way that this will
work is if you hook onto the #mouseWheeled event generated by the
view(s) contained within the ScrollingDecorator (or override the
#onMouseWheeled methods in their interactor/presenter) and use that to
call the SD's #onMouseWheeled method.  Seems a bit of a round-about way
to do it though so, again, am I missing something obvious?

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Scrolling a ScrollingDecorator

Bill Schwab-2
Ian,

> I noticed some methods in ScrollingDecorator that _seem_ to imply that
> scrolling this view using the mouse wheel should work "out of the box".
> I couldn't seem to get this to work - am I missing something obvious?
>
> From a (non exhaustive) play it seems that the only way that this will
> work is if you hook onto the #mouseWheeled event generated by the
> view(s) contained within the ScrollingDecorator (or override the
> #onMouseWheeled methods in their interactor/presenter) and use that to
> call the SD's #onMouseWheeled method.  Seems a bit of a round-about way
> to do it though so, again, am I missing something obvious?

IIRC, the mouse wheel also generates up/down arrow presses, or at least got
translated to that in something I was using recently.  Re tablets, this has
me wondering about missing or extraneous default procedure calls again????

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Scrolling a ScrollingDecorator

Blair McGlashan
In reply to this post by Ian Bartholomew-18
"Ian Bartholomew" <[hidden email]> wrote in message
news:Hurea.657$[hidden email]...

> I noticed some methods in ScrollingDecorator that _seem_ to imply that
> scrolling this view using the mouse wheel should work "out of the box".
> I couldn't seem to get this to work - am I missing something obvious?
>
> From a (non exhaustive) play it seems that the only way that this will
> work is if you hook onto the #mouseWheeled event generated by the
> view(s) contained within the ScrollingDecorator (or override the
> #onMouseWheeled methods in their interactor/presenter) and use that to
> call the SD's #onMouseWheeled method.  Seems a bit of a round-about way
> to do it though so, again, am I missing something obvious?

Try the Class Hierarchy Diagram - its doesn't set initial focus to the tree
(the view needs to be edited to set the #isTabStop property), so you'll have
to click over it first, but after that you should find it responds to the
mouse wheel.

As you'll see the CHD doesn't do anything special to get this support, and
neither does the MoenTreeView. Its possible that you have a focus issue as
well.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Scrolling a ScrollingDecorator

Ian Bartholomew-18
Blair,

> Try the Class Hierarchy Diagram - its doesn't set initial focus to
> the tree (the view needs to be edited to set the #isTabStop
> property), so you'll have to click over it first, but after that you
> should find it responds to the mouse wheel.

So it does.  I'll have a look to see what it is I have missed.

> As you'll see the CHD doesn't do anything special to get this
> support, and neither does the MoenTreeView. Its possible that you
> have a focus issue as well.

Quite possible.

What I meant in my original post by "working out of the box" though was
that just creating a simple shell/scroller/a.n.other  and expecting the
mouse wheel to function without any further code doesn't appear to work.
For example

- Create a Shell subclass called Test
- Add a ShellView view with BorderLayout manager
- Drop a ScrollingDecorator on the ShellView and give it an arrangement
of #centre
- Drop another view onto the scroller (MultilineTextEdit for example)
and give it an extent of 1000@1000

When you #show this you can enter text and move the clipped view about
by using the scroll bars but not by using the mouse wheel.  I tried
different "inner" view classes and the result seems to be the same.

I shall don my deerstalker and investigate further :-)

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Scrolling a ScrollingDecorator

Blair McGlashan
Ian

You wrote in message news:tiBea.752$[hidden email]...

> ...
> What I meant in my original post by "working out of the box" though was
> that just creating a simple shell/scroller/a.n.other  and expecting the
> mouse wheel to function without any further code doesn't appear to work.
> For example
>
> - Create a Shell subclass called Test
> - Add a ShellView view with BorderLayout manager
> - Drop a ScrollingDecorator on the ShellView and give it an arrangement
> of #centre
> - Drop another view onto the scroller (MultilineTextEdit for example)
> and give it an extent of 1000@1000
>
> When you #show this you can enter text and move the clipped view about
> by using the scroll bars but not by using the mouse wheel.  I tried
> different "inner" view classes and the result seems to be the same.

In some cases (like MultilineTextEdit), that's probably because they do
their own internal scrolling, and are therefore absorbing the mouse wheel
events such that the ScrollingDecorator never sees them. It would be
possible to work around this by using a specialised Interactor to redirect
the mouse events to the ScrollingDecorator parent.

In the case of static controls it might be for the same reason, or because
they refuse focus.

Regards

Blair