in reply to Win32::GUI problem
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Win32::GUI problem
by Anonymous Monk on Sep 24, 2015 at 09:45 UTC | |
Re^2: Win32::GUI problem
by Anonymous Monk on Sep 25, 2015 at 09:44 UTC | |
by Albannach (Monsignor) on Sep 25, 2015 at 11:44 UTC | |
by Anonymous Monk on Sep 26, 2015 at 09:48 UTC |
In Section
Seekers of Perl Wisdom