You can catch mouse events from your window and then do whatever you want in the assigned subs:
use strict;
use warnings;
use Win32::GUI;
my $draw = 0;
my $mw = Win32::GUI::Window->new(
-title => "Click anywhere to draw",
-pos => [100,100],
-size => [500,500],
-onMouseDown => \&down,
-onMouseUp => \&up,
-onMouseMove => \&move,
);
my $DC = $mw->GetDC;
$mw->Show();
Win32::GUI::Dialog();
exit(0);
sub down {
my ($object, $x, $y) = @_;
$draw = 1;
$DC->TextOut(10,10,"start $x,$y");
return 1;
}
sub up {
my ($object, $x, $y) = @_;
$draw = 0;
$DC->TextOut(400,10,"end $x,$y");
return 1;
}
sub move {
my ($object, $x, $y) = @_;
return unless $draw;
$DC->SetPixel($x,$y,[192,192,192]);
$DC->TextOut(200,10,"at $x,$y");
return 1;
}
--
I'd like to be able to assign to an luser
|