[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Problems with Double Buffer

Well, hard to say without more code, but SWT.DOUBLE_BUFFER should do the 
job. Have you also tried setting SWT.NO_BACKGROUND to prevent the background 
redrawing and possibly flickering?

If it doesn't you can do a workaround I used for a while which is you create 
a different GC object that you draw everything onto, then you basically 
transfer the drawing from that GC onto the current one, that way the user 
doesn't see the redraw until you draw it from one GC to the other. I 
wouldn't recommend it, but it worked in early SWT versions when Double 
Buffer wasn't as good as it is now, but that said, it works fine for me in 
the widgets I have written that are completely drawn.

Emil

-- 
Emil Crumhorn
Nebula Committer
http://www.hexapixel.com/


"KiMoon" <ibatis@xxxxxxxxx> wrote in message 
news:bbd224dc605d6e710a3e3145a8975247$1@xxxxxxxxxxxxxxxxxx
> hi.
>
> By using double buffer, while drawing bar chart with horizontal scroll, 
> there's a problem when adding a legend. Trying to put a legend section on 
> the top right side of a view, as we scroll it from left to right, the 
> legend flickers often, which makes the problem.
> how do we make it not flickering so that always setting it on the fixed 
> place?
> And also when using double buffer, when we draw the legend upon a image, 
> then when scrolling it, the legend often disappears instantly.
> I need any kind of help. thanks.
>
>
>
> canvas.addListener(SWT.Paint, new Listener() {
> public void handleEvent(Event event) {
> event.gc.drawImage(image, 0, 0);
>
>
> /** draw legend **/
> event.gc.setBackground(color);
> event.gc.fillRectangle(x, y, w, h);
> event.gc.drawText(string, x, y);
>
> event.gc.dispose();
> }
> }
> });
>