Custom panel refresh rates

James Bigler bigler at cs.utah.edu
Mon May 14 06:14:05 PDT 2007


Hi,

Vadim Zeitlin wrote:
> On Fri, 11 May 2007 07:16:23 -0600 James Bigler <bigler at cs.utah.edu> wrote:
> 
> JB> The problem I'm seeing is that the first of the panels to redraw gets 
> JB> updates significantly more often than the second which gets more than 
> JB> the third (a sample ratio is 297/48/21).
> 
>  This is very strange. A single Refresh() should result in no more than a
> single update (although not exactly one as calling Refresh() immediately
> again after just calling it would still result in a single redraw).

I agree.  Calling Refresh X number of times, does not guarantee X calls 
to OnPaint.  My problem is when I call Refresh on 3 panels X number of 
times and OnPaint is called drastically different number of times for 
each.  See below.

> JB> I traced into Refresh() and it makes some windows API calls 
> JB> (::RedrawWindow(hWnd, pRect, NULL, flags)).  How does Windows determine 
> JB> which windows to refresh?  Is there a way I can get all the windows to 
> JB> refresh equally?
> 
>  Is your problem that the window is refreshed too often or not often
> enough?

I'm not getting enough refreshes in the two "slower" windows.  Movement 
in the first window the refreshes the most, looks smooth and fluid.  In 
the other two windows that refresh less often it looks jerky, as if it 
doesn't get enough OnPaint calls.

I just added a counter to keep track of the number of times Refresh was 
called when moving an object in panel 2, and this is what I'm seeing.

Panel      1      2     3
Refresh  171    171   171
OnPaint  142     23    13

So, even though refresh is called the same number of times, OnPaint is 
called disproportionately fewer times on the second and third panels.

Thanks,
James




More information about the wx-users mailing list