Thanks again. After a little more research, I came up with the
following which I am still working on. I'll be using the GetTickCount
so that I can tell if the user clicked, double-clicked or began to
drag the mouse. With a little luck and the help of you guys on this
list, I might just end up with a working model in a week or so.
sub MouseMove
{
if($mouseisdown == 1)
{
print "Moving: " . (join "," , GetMouseXY()) . "\n";
}
}
sub MouseDown
{
$mouseisdown=1;
$mousedownticks = Win32::GetTickCount();
($mouseisdownx,$mouseisdowny) = GetMouseXY();
#print $mousedownticks;
print "MouseDown " . (join "," , ($mouseisdownx,$mouseisdowny)) . "\n";
}
sub MouseUp
{
$mouseisdown=0;
$mouseupticks = Win32::GetTickCount();
#print ($mouseupticks - $mousedownticks);
($mouseisupx,$mouseisupy) = GetMouseXY();
print "MouseUp " . (join "," , ($mouseisupx,$mouseisupy)) . "\n";
}
sub GetMouseXY
{
my ($x,$y) = $ChildWin->ScreenToClient(Win32::GUI::GetCursorPos);
return ($x, $y);
}
On 7/6/05, Glenn Linderman <[EMAIL PROTECTED]> wrote:
>
>
> On approximately 7/6/2005 7:52 AM, came the following characters from
> the keyboard of Chris Rogers:
> > Thanks for the info. It works perfectly. Too bad the ppm I installed
> > didn't include the samples.
> >
> > I was able to get the mouse coordinates using:
> > my $GetMouseCoord = new Win32::API('user32', 'GetCursorPos', 'P', 'V');
> > my $point = pack('LL', 0, 0);
> > $GetMouseCoord->Call($point);
> > my ($x, $y) = unpack('LL', $point);
>
> my ( $x, $y ) = Win32::GUI::GetCursorPos();
>
> might do that trick in fewer lines... and it might be window relative...
>
> > Now I just have to get the coordinates of the mainwindow,childwindow,
> > and bitmap so I can make the mouse coordinates relative to the bitmap
> > instead of the screen.
>
> Look at $window->GetWindowRect();
>
> > Thanks again,
> > Chris
> >
> >
> > On 7/6/05, Glenn Linderman <[EMAIL PROTECTED]> wrote:
> >
> >>[Questions about Win32::GUI might be found and responded to faster on
> >>the perl-win32-gui-users list on sourceforge.net.]
> >>
> >>On approximately 7/5/2005 7:19 PM, came the following characters from
> >>the keyboard of Chris Rogers:
> >>
> >>
> >>>UPDATE:
> >>>
> >>>The more I look at this problem, the more worried I get. I'll explain
> >>>the desired end result in a little more detail so you guys can tell me
> >>>if I'm barking up the wrong tree.
> >>>
> >>>1) I need to be able to display a large image in a smaller container
> >>>and allow the user to scroll the image in the container.
> >>
> >>There is some nice sample code Jez White contributed and I massaged a
> >>bit to make more generic, in the source tree for Win32::GUI
> >>samples/BitmapScroll.pl It solves this problem nicely.
> >>
> >>
> >>>2) I need to be able to capture the xy coordinates relative to the
> >>>image when the user clicks the mouse.
> >>>3) I need to be able to capture the xy coordinates relative to the
> >>>image when the user presses the mouse button as well as the
> >>>coordinates when the user releases the button.
> >>
> >>I haven't needed these myself, but there are mousedown and mouseup sorts
> >>of events for windows, as well as click, so I think it should work.
> >>
> >>
> >>>The big picture:
> >>>I would like to display an image and allow the user to click and drag
> >>>to define areas in the image. I will store the defined area and allow
> >>>the user to give it a name, description and either a destination image
> >>>or select a list of assets that reside in that area. That way when
> >>>the user clicks a defined area, a new image or the inventory list can
> >>>be displayed.
> >>>
> >>>It sounds like a simple task but I'm just not sure if there is a way
> >>>to do this in Win32::GUI. I thought the label control would work but
> >>>I'm not even sure that it responds to the Click event.
> >>
> >>Labels are pretty limited. I was using them in despair until Jez showed
> >>me the way...
> >>
> >>
> >>>Please feel free to tell me if I'm crazy but there has to be a way to do
> >>>this.
> >>>
> >>>Thanks,
> >>>Chris
> >>>
> >>>On 7/5/05, Chris Rogers <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>>Is there a way to keep a label from resizing itself and the bitmap?
> >>>>
> >>>>Here's the scenario:
> >>>>I want to use a label that is 400x400 to hold a bitmap whose
> >>>>dimensions are unknown and use scroll bars to move the image around if
> >>>>the image is larger than the label. The need here is to be able to
> >>>>display very large images without distortion and allow the user to
> >>>>move around in the image.
> >>>>
> >>>>Adding the scroll bars to the label is easy enough using
> >>>> -addstyle=3D>WS_VSCROLL|WS_HSCROLL
> >>>>but everything I have tried has resized either the label or the bitmap.
> >>>>
> >>>>Perhaps I am going about this the wrong way and am open to to other
> >>>>suggestions.
> >>>>
> >>>>Thanks,
> >>>>Chris
> >>>>
> >>>
> >>>
> >>>_______________________________________________
> >>>Perl-Win32-Users mailing list
> >>>[email protected]
> >>>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >>>
> >>>
> >>>
> >>>
> >>
> >>--
> >>Glenn -- http://nevcal.com/
> >>===========================
> >>Having identified a vast realm of ignorance, Wolfram is saying that much
> >>of this realm lies forever outside the light cone of human knowledge.
> >> -- Michael Swaine, Dr Dobbs Journal, Sept 2002
> >>
> >
> >
> > _______________________________________________
> > Perl-Win32-Users mailing list
> > [email protected]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
> >
> >
> >
>
> --
> Glenn -- http://nevcal.com/
> ===========================
> Having identified a vast realm of ignorance, Wolfram is saying that much
> of this realm lies forever outside the light cone of human knowledge.
> -- Michael Swaine, Dr Dobbs Journal, Sept 2002
>
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs