|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
bitmap - getting mouse clicks and mouse locationHello,
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 Instant access to the latest & most popular FREE games while you browse with the Games Toolbar - Download Now! ------------------------------------------------------------------------- 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@... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ |
|
|
Re: bitmap - getting mouse clicks and mouse locationi have experemented using as a guide the message:
http://www.mail-archive.com/perl-win32-gui-users@lists.sourceforge.net/msg03025.html here 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; }
|
|
|
Re: bitmap - getting mouse clicks and mouse locationTo get the absolute X and Y coordinates, would you have to subtract the position of the child (label) from the position of the parent (main window)? pc -----Original Message----- From: zak3 [mailto:zak31415@...] Sent: Friday, November 21, 2008 2:21 AM To: perl-win32-gui-users@... Subject: Re: [perl-win32-gui-users] bitmap - getting mouse clicks and mouse location i have experemented using as a guide the message: http://www.mail-archive.com/perl-win32-gui-users@.../msg03 025.html here 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@... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ > -- View this message in context: http://www.nabble.com/bitmap---getting-mouse-clicks-and-mouse-location-tp205 49181p20618513.html Sent from the perl-win32-gui-users mailing list archive at Nabble.com. ------------------------------------------------------------------------- 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@... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ ------------------------------------------------------------------------- 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@... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ |
|
|
Re: bitmap - getting mouse clicks and mouse locationTry the following: use strict; use warnings; use Win32::GUI (qw {WS_CAPTION WS_SIZEBOX WS_CHILD WS_CLIPCHILDREN WS_EX_CLIENTEDGE}); 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, ); my $childwindow = new Win32::GUI::Window ( -parent => $W, -name => 'bitmap window', -left => 4, -top => 4, -width => 270, -height => 232, -popstyle => WS_CAPTION | WS_SIZEBOX, -pushstyle => WS_CHILD | WS_CLIPCHILDREN, -pushexstyle => WS_EX_CLIENTEDGE, #-hscroll => 1, #-onScroll => \&Generic_Scroll, -onMouseMove => \&Generic_MouseMove, -onPaint => \&Generic_Paint, -onMouseDown => \&Generic_MouseDown, ); $childwindow->Show; sub Generic_MouseMove { my ($win,$xcor,$ycor)=@_; print "MouseMove $win,$xcor,$ycor\n"; } sub Generic_Paint { my $win=shift; print "Paint $win\n"; } sub Generic_MouseDown { my ($win,$xcor,$ycor)=@_; print "MouseDown $win,$xcor,$ycor\n"; $textfield -> Append( "$xcor - $ycor \n") } $W->Show(); Win32::GUI::Dialog(); exit(0); sub Window_Terminate { return -1; } > From: pcourterelle@... > To: perl-win32-gui-users@... > Date: Fri, 21 Nov 2008 13:08:47 -0800 > Subject: Re: [perl-win32-gui-users] bitmap - getting mouse clicks and mouse location > > > To get the absolute X and Y coordinates, would you have to subtract the > position of the child (label) from the position of the parent (main window)? > > pc > > > -----Original Message----- > From: zak3 [mailto:zak31415@...] > Sent: Friday, November 21, 2008 2:21 AM > To: perl-win32-gui-users@... > Subject: Re: [perl-win32-gui-users] bitmap - getting mouse clicks and mouse > location > > > > i have experemented using as a guide the message: > http://www.mail-archive.com/perl-win32-gui-users@.../msg03 > 025.html > > here 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@... > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > http://perl-win32-gui.sourceforge.net/ > > > > -- > View this message in context: > http://www.nabble.com/bitmap---getting-mouse-clicks-and-mouse-location-tp205 > 49181p20618513.html > Sent from the perl-win32-gui-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > 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@... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ > > > ------------------------------------------------------------------------- > 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@... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ BigSnapSearch.com - 24 prizes a day, every day. Search now ------------------------------------------------------------------------- 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@... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ |
| Free embeddable forum powered by Nabble | Forum Help |