I'm working on a program that has a window with a background
picture. Most of the action takes place in a large canvas that I do
a lot of drawing into as a result of user actions, such as clicking
and dragging in that canvas. As it's getting more complex the
responsiveness is substantially reduced. If I clicked on something,
which will cause my program to draw it differently (so it appears
selected) it takes several seconds to happen. After some
investigation I realize that in response to that click I am getting
a big pile of calls to the canvas' paint method.
It's as if the OS doesn't believe I've "satisfied" the paint
request. If I put code in there that does nothing except let me know
it's been called, then the calls never stop.
Am I doing something that's obviously wrong? If I remove the
background picture the calls are *substantially* reduced, for what
it's worth. I tried drawing the background image myself, but that
only made things worse, as the window.paint method was called
continuously.
Thanks for any insights,
Steve
If you're using OSX, try running QuartzDebug. It gives you several
ways to see where and when your app is drawing.
Are you calling refresh anywhere? Generally you shouldn't use refresh
and do all your drawing to the canvas, either when notified by the
Paint event or when you need to change the contents.
RB's canvas' can be quite fast. Check out Joe Strout's DragDemo
project for a great example of how to do layered drawing and dragging
in a canvas.
Regards,
Joe Huber
_______________________________________________
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>