Hi Daniel

The following webpage has Aaron Ballman's implementation of a double
buffered canvas which is a class in his project.

http://ramblings.aaronballman.com/?p=376

I had to refer to the RB user's manual to understand about the event
definitions used in his project as I hadn't needed to implement event
definitions before.  The Open and Paint event definitions gives us
access to these events in any instance of the class and you just need
one subclassed canvas.

You must rework your paint event in your subclassed canvas to do all
the necessary drawing that the single canvas should do on screen.  I
now use a For loop to start at the first item that needs to be drawn
and exit the loop once the drawing exceeds the screen height
dimensions.

I had a canvas control array sitting on my scrollable canvas.  The
instances of the control array had their own properties and the paint
event of the instances used to handle the drawing (by referencing a
drawing method).  As the control array no longer needed to be used, I
moved all properties of the control array to global variable arrays.
These global variable arrays were then referenced in the drawing
method instead of the old properties of the control array instances.

Whenever your window should be scrolled, specify what needs to be
drawn (you can add some window properties related to this and use them
in the paint event and set them elsewhere in your project).  Then call
the Redraw method like in Aaron's sample project which invokes the
paint event to do any initial drawing.  The paint event maintains the
drawing thereafter.

Understand what your canvas scrolling and drawing currently does,
document it, write down all changes you think are necessary and
comment out old code that you can reference if things aren't working
as they should when you make the changes.

So far, my changes have been working smoothly and the changes will
simplify the project's code.

Regards

Paul

On 12/13/06, Daniel Stenning <[EMAIL PROTECTED]> wrote:
Its a while since I had to work on canvases but I will have to return to my
main GUI based project in the new year which uses many canvases, so I would
very much appreciate if you could send me your optimisations and tips etc.
I wrote my own generic code for canvas scrolling  a few years back , when I
needed to - but always felt a bit unsatisfied with my solution and having to
do it all in the first place:

A) because I actually felt RS should have provided more built in features to
handle this sort of stuff  ( such as being able to draw to a 2D/3D surface
once and have RB automatically redraw a specified "window" from this space
and handle the scrolling automatically. Surely there has to be a better way
to do this than the current framework.

B) maybe someone else knows how to do this better :)

Maybe RB canvases have moved on since I last had to use them ( v 5.5 ) but I
remember feeling that a lot of this stuff could in 90% of apps have been
better handled intrinsically by RB.

So hers my question:  is the current implementation of canvase optimal ?
does it need to be reformed ? Rewritten? Just evolved ?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to