From: Mattia B. <mb...@ds...> - 2003-04-23 21:30:37
|
On Wed, 23 Apr 2003 05:39:19 -0700 (PDT) DH <cra...@ya...> wrote: > With the help of the magical Canvas widget, I have created > > perlTk Type Tutor - useful for learning a DVORAK keyboard layout > http://perlmonks.com/index.pl?node_id=229960 > > Now I wanna write one in wx. > > So milling about the wxperl docs like I always do, I realize I need > to use a wxClientDC to setup my picture, > and wxPaintDC to redraw as triggered by an OnPaint event. Yes. To be precise: if you are handling a paint event, you MUST create a Wx::PaintDC (even if you don't use it!), if you aren't handling a paint event, you just create a Wx::ClientDC and use it. > So I would use ::wxPostEvent to post a wxPaintEvent to my > wxFrame/wxPanel? No, you use Wx::Window->Refresh (because, in general, using PostEvent/SendEvent to send "system" messages (move, resize, paint, scroll...) is a bad idea (=unportable, might cause strange errors)) > Will I need to paint the entire picture (keyboard) every time > a wxPaintEvent is triggered? You can use a clipping region, if you want (passing an invalidate rect to ->Refresh) HTH Mattia |