[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: using PaintListener causes components to not redraw when focus gained

While producing the requested snippet, my user error became obvious. In the PaintListener, I was scaling the image, and then calling setBackgroundImage() on the Widget, which is a Composite.

Everything works correctly when I modified it to use GC.drawImage(Image, int, int).

FYI, the reason I prefer calling Composite.setBackgroundImage() is so that child widgets inherit the background image, which doesn't happen when I draw on the parent composite directly.

Thanks,

Alej.

Grant Gayed wrote:
This should not be the case.  Please log a report with SWT at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform&component=SWT
and provide a snippet that shows it happening (snippet template:
http://www.eclipse.org/swt/faq.php#whatisasnippet ).

Thanks,
Grant


"Alejandro Bascuas" <alej@xxxxxxxxxx> wrote in message news:fuqcm0$r9l$1@xxxxxxxxxxxxxxxxxxxx
I was using a PaintListener to scale a background image when the
Composite is resized.

I noticed that when my shell loses focus, and then regains, the controls
within it were not being automatically redrawn. It seems like adding the
PaintListener broke some chain where elements are redrawn by the OS
(Windows XP in my case) when a window moves to the foreground.

I was able to work around this by scaling my image in a ControlListener.
However, adding a PaintListener should not cause this type of failure.

Any comments?

Alej.