Onpaint madness

63q2o4i02 at sneakemail.com 63q2o4i02 at sneakemail.com
Tue Sep 5 12:20:16 PDT 2006


>
> On 2 Sep 2006 13:44:25 -0700, 63q2o4i02 at sneakemail.com
> <63q2o4i02 at sneakemail.com> wrote:
> >
> > Vadim Zeitlin wrote:
> > > On 1 Sep 2006 18:49:54 -0700 63q2o4i02 at sneakemail.com wrote:
> > >
> > > > I'm getting a zillion OnPaint messages with no luck in trynig to handle
> > > > them.
> > >
> > >  The most likely reason is that you don't create wxPaintDC for the window
> > > which must be repainted and so it remains invalidated resulting in more
> > > paint events being sent.
> > >
> >
> > Yes, I've tried creating even a dummy wxPaintDC, but it still won't
> > stop sending messages to the frame.  Should each subwindow have its own
> > class and therefore its own OnPaint handler?  Right now I'm letting the
> > frame handle the message and then draw on the subwindows directly.
> > Perhaps this is causing them to generate a new paint message, but since
> > there is no subwindow handler it goes right back to the Frame?



I figured out what I was doing wrong: I forgot to pass a "this" pointer
to the wxPaintDC variable.  Once I did that it stopped acting crazy and
started working like I'd expect.  In the meantime, however, I
subclassed the wxPanels and implemented a separate OnPaint function for
each of them.

ms







More information about the wx-users mailing list