hello
i refer  to the "rpnoble" question:
((((In the Draw.pl example, all program action takes place in the timer
event. Is
there a way to trigger a default program action without using the timer
event once the program has called Win32::GUI::Dialog()? In all of my
win32::GUI programs, I use a menu or button to start action.
))))))
here is a not optimized code which display a black rectangle and a red line
whith thickness "2" upon a click on a button , and erase the draw upon the
click of another button,  i have cut the code from a very long file .
the only problem with the draw is that it is erased when we cover it whith
another window.


use Win32::GUI;

my $mw = new Win32::GUI::Window(
    -left   => 0,
    -top    => 0,
    -width  => 638,
    -height => 478,
    -name   => "mw",


);
$mw->AddButton(
                -name => "Button1",
                -text => "RUN ",
                -pos  => [ 0, 0 ],
    );
$mw->AddButton(
                -name => "Button2",
                -text => "CLS ",
                -pos  => [ 0, 30 ],
    );
$mw->Show();
Win32::GUI::Dialog();

sub Window_Terminate {
    return -1;
}
sub Button1_Click {

    my $DC = $mw->GetDC;
    my @colrB = "0,0,0";   #color of background
    $x=0; $y=0;
    @colrBR= map { split ',', $_ } @colrB;
    $P = new Win32::GUI::Pen(
              -color => [ @colrBR],
              -width => 1,
     );
    $B = new Win32::GUI::Brush(
            [EMAIL PROTECTED]

        );
        $oldP = $DC->SelectObject($P);
        $oldB = $DC->SelectObject($B);
        $DC->Rectangle(70, 45, 300, 200);
       my @colrF = "245, 56, 10"; #color of Foreground
        $pointsize = "2";
        @colrFR= map { split ',', $_ } @colrF;
   for (my $i= 1; $i <= 400; $i += 1) {
  $P = new Win32::GUI::Pen(
              -color => [ @colrFR],
              -width => 1,
        );

        $B = new Win32::GUI::Brush(
            [ @colrFR]

        );
        $oldP = $DC->SelectObject($P);
        $oldB = $DC->SelectObject($B);
$x+=1; $y+=1;
$DC->Circle($x, $y,$pointsize);
}
}

sub Button2_Click {
   $mw -> InvalidateRect(1);

 }
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to