George, Win32-GUI operates in the same way as any other language - its event driven. How does windows know to update a window? In some cases it can work it out - for example when a window is covered by other windows. In other cases, you have to tell windows to update - you do this by invalidating the window (which then fires the paint event). In your case when the user presses a button - its one method call.
In cases were performance is an issue you draw to a DC, and then bitblt this to the screen. From memory there is an example of this in the examples that come with later versions of Win32-GUI. Cheers, Jeremy. -----Original Message----- From: "George" <[EMAIL PROTECTED]> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>; "perl-win32-gui-users@lists.sourceforge.net" <perl-win32-gui-users@lists.sourceforge.net> Sent: 30/05/07 14:37 Subject: Re: [perl-win32-gui-users] Refreshing the Window thanks for the response, but where should we insert the invalidate function, i am lost completely. and many discussions in the forum are complicated and for experts only, i have tried many variations with no success. the available examples in the forum are calling a sub paint which includes the drawing functions inside it ,and it happend the drawing functions are speedy, but suppose a function are drawing a fractal and this is a time consuming, then we will see that this approach is unpractical, we just want to refresh the points of color ,and not to recalculate the code everytime we move or hide the window. i wish that a future version of win32-gui may have something like AutoRedraw property in visual basic 6 which are refreshing the Form . i repost the example who need a cure, the problem is that i want the rectangle to be drawn uppon a click from a button and not within a paint procedure or a Timer. #!perl -w use strict; use warnings; use Win32::GUI qw(); my $mw = Win32::GUI::Window->new( -title => 'Graphic', -size => [ 400, 300 ], #-onPaint => \&paint, ); $mw->AddButton(-name=>"button1",-text=>"RUN ",-left=>0,-top=>0); $mw->Show(); Win32::GUI::Dialog(); $mw->Hide(); exit(0); sub button1_Click { my $dc = $mw->GetDC; #my ($self, $dc) = @_; $dc->Validate(); # Draw a rectangle $dc->Rectangle(100,100,200,200); return 0; } regards --------------------------------- Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.