i have experemented using as a guide the message:
http://www.mail-archive.com/perl-win32-gui-users@lists.sourceforge.net/msg03025.htmlhere is a main form and a Label, when you click on the Label, the textfield control will show the coordinates of mouse cursor , it seems to me that those coordinated are relative to the screen, you may adapt the code to display the coordinates relative to the form or relative to the label, or a graphic control.
use strict;
use warnings;
use Win32::GUI();
my $W = new Win32::GUI::Window(
-name => "W",
-title => "mouse click tracking",
-left => 54,
-top => 77,
-width => 546,
-height => 318,
);
my $textfield = $W->AddTextfield(
-text => "",
-name => "Textfield_1",
-left => 401,
-top => 9,
-width => 129,
-height => 249,
-multiline => 1,
-vscroll => 1,
);
$W->AddLabel(
-text => "zz",
-name => "Label_2",
-left => 0,
-top => 0,
-width => 270,
-height => 232,
-foreground => 0,
-background => 12615935,
-notify => 1,
-onMouseDown => sub { my($mx, $my) = Win32::GUI::GetCursorPos();$textfield -> Append( "$mx - $my \n");},
);
$W->Show();
Win32::GUI::Dialog();
exit(0);
sub Window_Terminate {
return -1;
}
iaagaiow wrote:
Hello,
I'm developing an app which will display a bitmap.? I want to be able to detect mouse clicks on the bitmap and get the mouse cursor location when clicks are detected.
Displaying the bitmap is easy - there are demos that show that.? I have been trying to modify the demos to detect clicks and get the mouse cursor location, but nothing has worked yet.? Have been going thru doc/demos/etc, and will keep doing so, but if you happen to have experience with this topic, please send me any pointers you can.
I have tried using GetCursorPos, but thus far seem to be getting undefined return values.? As for the mouse click, tried setting up -onClick option but this seems to be ignored.
Thanks for your time!
Regards,
LP
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-usershttp://perl-win32-gui.sourceforge.net/