so in win32gui how to keep the plot from been erased when covered by other windows !!. the usual plan for this is to redraw the same line code again and again if you uncomment the lines:use strict; use warnings; use Win32::GUI(); our $NumberOfLinesDrawn = 0; my $Win = new Win32::GUI::Window( -left => 0, -top => 0, -width => 500, -height => 400, -name => "Window", -text => "drawing a line", ##-onPaint => \&Draw, ); $Win->Show(); Draw(); Win32::GUI::Dialog(); sub Window_Terminate { return -1; } sub Draw { my $DC = $Win->GetDC; my $x = 0; my $y = 0; for(1..300) {$y +=1; $x +=1; $DC->SetPixel($x,$y); } ##$DC->Validate(); $NumberOfLinesDrawn +=1; print "$NumberOfLinesDrawn\n"; }
but i think this is not the same way other modules or languages deals with updating the window ie by updating the pixels of the screen, in comparison the same TK code is concise and working well:-onPaint => \&Draw ##and $DC->Validate();
use warnings; use strict; use Tk; my $mw = MainWindow->new; my $x = 0; my $y = 0; my $counter=0; our $NumberOfLinesDrawn = 0; my $c = $mw->Canvas(-width => 500, -height => 500); $c ->pack; for(1..300) {$y +=1; $x +=1; $c -> createText( $x, $y, -fill => 'red', -text => '.'); } $mw->update; $NumberOfLinesDrawn +=1; print "$NumberOfLinesDrawn\n"; MainLoop;
In reply to updating the window in Win32 GUI by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |