Resizing the Canvas when scrolling [message #147086] |
Tue, 10 August 2004 14:45  |
Eclipse User |
|
|
|
Hi,
I have a graphical editor and i want the canvas to grow when the
viewport is at the edge of the canvas and the user clicks on a
scrollbar. So far, looking at the code, it seems as if i need to
subclass FigureCanvas and at the very least override scrollToX(int
hOffset) and scrollToY(int vOffset) to resize the RangeModels. This is
not a problem. The problem is that i want the ScrollingGraphicalViewer
of my editor to now use my new FigureCanvas. First i tried simply
setting my new FigureCanvas as the ScrollingGraphicalViewers control,
but i had difficulty getting ahold of the LightweightSystem. Then, i
tried subclassing ScrollingGraphicalViewer. Unfortunately, the
createControl(Composite parent) method on the ScrollingGraphicalViewer
(where the FigureCanvas is created) is final!
Am i on the right track here or is there an easier way of setting a new
type of FigureCanvas on the ScrollingGraphicalViewer? Does my approach
to growing the canvas when the user scrolls even make sense?
Thanks for any insight,
Sean Kirby
|
|
|
Re: Resizing the Canvas when scrolling [message #147113 is a reply to message #147086] |
Tue, 10 August 2004 16:46   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
All you need to do is modify the RangeModel which is used by the
figurecanvas.
"Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
news:cfamtn$9o8$1@eclipse.org...
> Hi,
>
> I have a graphical editor and i want the canvas to grow when the
> viewport is at the edge of the canvas and the user clicks on a
> scrollbar. So far, looking at the code, it seems as if i need to
> subclass FigureCanvas and at the very least override scrollToX(int
> hOffset) and scrollToY(int vOffset) to resize the RangeModels. This is
> not a problem. The problem is that i want the ScrollingGraphicalViewer
> of my editor to now use my new FigureCanvas. First i tried simply
> setting my new FigureCanvas as the ScrollingGraphicalViewers control,
> but i had difficulty getting ahold of the LightweightSystem. Then, i
> tried subclassing ScrollingGraphicalViewer. Unfortunately, the
> createControl(Composite parent) method on the ScrollingGraphicalViewer
> (where the FigureCanvas is created) is final!
>
> Am i on the right track here or is there an easier way of setting a new
> type of FigureCanvas on the ScrollingGraphicalViewer? Does my approach
> to growing the canvas when the user scrolls even make sense?
>
> Thanks for any insight,
> Sean Kirby
|
|
|
Re: Resizing the Canvas when scrolling [message #147238 is a reply to message #147113] |
Wed, 11 August 2004 14:18  |
Eclipse User |
|
|
|
Thanks Randy,
The functionality that i wanted is actually more or less already
implemented by the auto scrolling feature provided by the
ViewPortAutoexposeHelper.
sk
Randy Hudson wrote:
> All you need to do is modify the RangeModel which is used by the
> figurecanvas.
>
> "Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
> news:cfamtn$9o8$1@eclipse.org...
>
>>Hi,
>>
>>I have a graphical editor and i want the canvas to grow when the
>>viewport is at the edge of the canvas and the user clicks on a
>>scrollbar. So far, looking at the code, it seems as if i need to
>>subclass FigureCanvas and at the very least override scrollToX(int
>>hOffset) and scrollToY(int vOffset) to resize the RangeModels. This is
>>not a problem. The problem is that i want the ScrollingGraphicalViewer
>>of my editor to now use my new FigureCanvas. First i tried simply
>>setting my new FigureCanvas as the ScrollingGraphicalViewers control,
>>but i had difficulty getting ahold of the LightweightSystem. Then, i
>>tried subclassing ScrollingGraphicalViewer. Unfortunately, the
>>createControl(Composite parent) method on the ScrollingGraphicalViewer
>>(where the FigureCanvas is created) is final!
>>
>>Am i on the right track here or is there an easier way of setting a new
>>type of FigureCanvas on the ScrollingGraphicalViewer? Does my approach
>>to growing the canvas when the user scrolls even make sense?
>>
>>Thanks for any insight,
>>Sean Kirby
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02888 seconds