Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Scrollable Canvas(Create a scrollable canvas)
icon5.gif  Scrollable Canvas [message #655736] Tue, 22 February 2011 14:23 Go to next message
Tripon Florian is currently offline Tripon FlorianFriend
Messages: 6
Registered: February 2011
Location: Timisoara
Junior Member

Hi everybody,

I am working right now on an application that draws intensively to the screen, namely on a Canvas. Whenever the Canvas is scrolled, I redraw large section of the screen based on input from the ScrollBars. This works fine on RCP, but I have had troubles getting it to work on RAP, mainly because the Canvas class is a Scrollable, but does not scroll.

I got some of the scrolling functionality by patching the rwt plugin. I placed a ScrollableComposite inside the Canvas class and routed all calls to it. This solution, I think, is a bit ugly, and, even though this solved some of the problems, it, created others. Before I commit to solving these new issues, I thought I might ask you guys for help.

So, if you know a cleaner way to make a Canvas that can be controlled by ScrollBar objects, please let me know.

Thanks,
Flo.
Re: Scrollable Canvas [message #655774 is a reply to message #655736] Tue, 22 February 2011 15:25 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Florian,
you could try to put the Canvas inside a ScrolledComposite. This should
work.
HTH,
Ivan

On 2/22/2011 4:23 PM, Tripon Florian wrote:
> Hi everybody,
>
> I am working right now on an application that draws intensively to the
> screen, namely on a Canvas. Whenever the Canvas is scrolled, I redraw
> large section of the screen based on input from the ScrollBars. This
> works fine on RCP, but I have had troubles getting it to work on RAP,
> mainly because the Canvas class is a Scrollable, but does not scroll.
>
> I got some of the scrolling functionality by patching the rwt plugin.
> I placed a ScrollableComposite inside the Canvas class and routed all
> calls to it. This solution, I think, is a bit ugly, and, even though
> this solved some of the problems, it, created others. Before I commit
> to solving these new issues, I thought I might ask you guys for help.
>
> So, if you know a cleaner way to make a Canvas that can be controlled
> by ScrollBar objects, please let me know.
>
> Thanks,
> Flo.
Re: Scrollable Canvas [message #655790 is a reply to message #655774] Tue, 22 February 2011 16:12 Go to previous messageGo to next message
Tripon Florian is currently offline Tripon FlorianFriend
Messages: 6
Registered: February 2011
Location: Timisoara
Junior Member

Hi Ivan,

Thanks for the quick reply.
That's what I did in the first place, but it did not work for me. My class extends Canvas and does its own drawing. It relays on the ScrollBar objects provided by the Scrollable class (in RCP) to know what he must draw. Keeping the same source code for both RCP & RAP meant that I must somehow get access to the scrollbar objects so I started playing around with the RWT package.

My current approach scrambles the internal logic of the class that needs to draw. The path, which I do not want to take, is to create a bunch of proxies that translate everything that relates to size and location.

I was hoping that there is a cleaner way of doing this Smile

Thanks,
Flo.
Re: Scrollable Canvas [message #655819 is a reply to message #655790] Tue, 22 February 2011 17:43 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Florian,
maybe I don't understand what you want to achieve, but if you put your
Canvas inside a ScrolledComposite and add a ControlListener to listen
for controlMoved event, you can get the scrollbar position from your
Canvas location.
HTH,
Ivan

On 2/22/2011 6:13 PM, Tripon Florian wrote:
> Hi Ivan,
>
> Thanks for the quick reply.
> That's what I did in the first place, but it did not work for me. My
> class extends Canvas and does its own drawing. It relays on the
> ScrollBar objects provided by the Scrollable class (in RCP) to know
> what he must draw. Keeping the same source code for both RCP & RAP
> meant that I must somehow get access to the scrollbar objects so I
> started playing around with the RWT package.
> My current approach scrambles the internal logic of the class that
> needs to draw. The path, which I do not want to take, is to create a
> bunch of proxies that translate everything that relates to size and
> location.
>
> I was hoping that there is a cleaner way of doing this :)
> Thanks,
> Flo.
Re: Scrollable Canvas [message #655951 is a reply to message #655819] Wed, 23 February 2011 13:50 Go to previous message
Tripon Florian is currently offline Tripon FlorianFriend
Messages: 6
Registered: February 2011
Location: Timisoara
Junior Member

Hi Ivan,

Thanks a lot for your input. It worked like a charm. I removed all references to the ScrollBar objects from the Canvas extending class. I'll give it a kick in RCP tomorrow to see if it still works.

This is where you get when the obvious solution is in front of you but you don't look at it because it is way too obvious.

Cheers,
Flo.
Previous Topic:RAP Example RMS(RAP): Missing Constraint: Require-Bundle: org.eclipse.rap.ui; bundle-version="0
Next Topic:That holy org.eclipse.ui package! :S
Goto Forum:
  


Current Time: Tue Oct 26 08:31:22 GMT 2021

Powered by FUDForum. Page generated in 0.02481 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top