In the following code, mouseMove is sent the label, and the x,y coridinates of the cursor. But if you hold the cursor down and, while holding the cursor down, move it to the corners of your screen, you will get invalid $x, $y values..

This looks to me as is Win32::GUI is sending the wrong mouse coordinates. Is this a bug or do I not understand something?

My resolution is 1024x768

Steve Lloyd
http://www.basgetti.com

----------------------Samle Output---------------------------
MouseMove 707,145
MouseMove 722,118
MouseMove 749,80
MouseMove 756,62
MouseMove 771,36
MouseMove 784,10
MouseMove 793,65524
MouseMove 802,65505
MouseMove 809,65491
MouseMove 816,65480
MouseMove 821,65470
MouseMove 829,65459
MouseMove 833,65451


------------------------------Win32 Code------------------------------
#!perl -w
# Left-Click on the target image, and drag
use warnings;
use strict;
use Win32::GUI;
use Win32::GUI::BitmapInline();
my $screen_width  = Win32::GUI::GetSystemMetrics(0);
my $screen_height = Win32::GUI::GetSystemMetrics(1);
my $mw = Win32::GUI::Window->new(
 -name => "MainWindow",
 -title => "Win32::GUI Spy++",
 -pos => [100,100],
 -size => [100,100],
 );
my $cursor = get_cursor();
$mw->AddLabel(
 -name => "Target",
 -icon => $cursor,
 -notify => 1,
 -onMouseDown => \&mouseDown,
 -onMouseUp => \&mouseUp,
 -onMouseMove => \&mouseMove,
 );

$mw->Show();
Win32::GUI::Dialog();
exit(0);
###########################
###########################
sub mouseDown{
 my $label = shift;
 Win32::GUI::SetCursor($cursor);
 $label->SetCapture();
 return;
 }
################
sub mouseUp{
 my $label = shift;
 $label->ReleaseCapture();
 Win32::GUI::InvalidateRect(0,0);
 return;
 }
#################
sub mouseMove{
 my ($label, $x, $y) = @_; # x,y in client co-ordinates
 print "MouseMove $x,$y\n";
 return;
 }

#####################
sub get_cursor{
return Win32::GUI::BitmapInline->newCursor( q(
AAACAAEAICAAAA8AEAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAAAA
AAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAGDAAACbIAABQFAAApsoA
AUAFAAECgQACoAqAAqgqgAIBAIACqCqAAqAKgAECgQABQAUAAKbKAABQFAAAJsgAABgwAAAHwAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////////////////////////g////g
D///wAf//4gj//8YMf/+ODj//nx8//wMYH/8A4B//AOAf/wDgH/8DGB//nx8//44OP//GDH//4gj
///AB///4A////g///////////////////////////////////////8=
) );
}




Reply via email to