Getting MouseMove to pass X,Y Coordinates 
Author Message
 Getting MouseMove to pass X,Y Coordinates

-------------------------------
QUESTION #1 How would I get the MouseMove Sub to pass it's X, Y Coordinates
to the Click Sub, upon the click event?

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)
<code>
End Sub

Private Sub Form_Click()
<code to receive the x and the y coordinate upon click>
End Sub

-----------------------------
QUESTION#2 Also, while still answering question1, Is there a standard code
that I could put in the click event to "tell me" the x, y coordinate, when
which when I click on the Form without using the mousemove sub to get the
coordinate?

Private Sub Form_Click()
<code to receive the x and the y coordinate upon click>
End Sub

Thank you in advance for sharing your knowledge with me



Sat, 06 Oct 2001 03:00:00 GMT  
 Getting MouseMove to pass X,Y Coordinates
On Tue, 20 Apr 1999 22:26:42 -0700, "Knowledge"

Quote:

>-------------------------------
>QUESTION #1 How would I get the MouseMove Sub to pass it's X, Y Coordinates
>to the Click Sub, upon the click event?

Put form level x and y coordinate variables in your form...

Dim MouseX As Single
Dim MouseY As Single

Quote:
>Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
>Y As Single)

Save the values of X and Y in the form level variables

MouseX = X
MouseY = Y

Quote:
>End Sub
>Private Sub Form_Click()

The values of MouseX and MouseY should be the approximate coordinates
of the click.  Try it and see!

Quote:
>End Sub
>-----------------------------
>QUESTION#2 Also, while still answering question1, Is there a standard code
>that I could put in the click event to "tell me" the x, y coordinate, when
>which when I click on the Form without using the mousemove sub to get the
>coordinate?

Instead of using the Form click event, use the Form's MouseUp or
MouseDown events, which detect when the mouse button is pressed or
released, _and_ give the coordinates of the mouse pointer.

If you want to detect a click, use the MouseUp event.

Zak  



Sun, 07 Oct 2001 03:00:00 GMT  
 Getting MouseMove to pass X,Y Coordinates
A click is about the same as a mouse down, and a mouse up.  Pick one
and pretend its the click event.  For more finesse, decide what to
do in the MouseDown event, and if it is still valid in the MouseUp
event, do it.

LFS

Quote:

> -------------------------------
> QUESTION #1 How would I get the MouseMove Sub to pass it's X, Y Coordinates
> to the Click Sub, upon the click event?

> Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
> Y As Single)
> <code>
> End Sub

> Private Sub Form_Click()
> <code to receive the x and the y coordinate upon click>
> End Sub

> -----------------------------
> QUESTION#2 Also, while still answering question1, Is there a standard code
> that I could put in the click event to "tell me" the x, y coordinate, when
> which when I click on the Form without using the mousemove sub to get the
> coordinate?

> Private Sub Form_Click()
> <code to receive the x and the y coordinate upon click>
> End Sub

> Thank you in advance for sharing your knowledge with me




Sun, 07 Oct 2001 03:00:00 GMT  
 Getting MouseMove to pass X,Y Coordinates
You could also setup Private variables for that form:

Option Explicit
Private sX as Single
Private sY as Single

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)

    sX=X
    sY=Y

End Sub

Private Sub Form_Click()

    If sX = ??? And sY = ??? Then
        ...
    End If

End Sub

--
Later,
Jody


http://www.visual-statement.com/vb

Quote:

>A click is about the same as a mouse down, and a mouse up.  Pick one
>and pretend its the click event.  For more finesse, decide what to
>do in the MouseDown event, and if it is still valid in the MouseUp
>event, do it.

>LFS


>> -------------------------------
>> QUESTION #1 How would I get the MouseMove Sub to pass it's X, Y
Coordinates
>> to the Click Sub, upon the click event?

>> Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As
Single,
>> Y As Single)
>> <code>
>> End Sub

>> Private Sub Form_Click()
>> <code to receive the x and the y coordinate upon click>
>> End Sub

>> -----------------------------
>> QUESTION#2 Also, while still answering question1, Is there a standard
code
>> that I could put in the click event to "tell me" the x, y coordinate,
when
>> which when I click on the Form without using the mousemove sub to get the
>> coordinate?

>> Private Sub Form_Click()
>> <code to receive the x and the y coordinate upon click>
>> End Sub

>> Thank you in advance for sharing your knowledge with me




Sun, 07 Oct 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Getting MouseMove to pass XY Coordinates

2. How do I coordinate the screen's coordinates with a form coordinate

3. Getting/Setting a Forms Window Coordinates

4. Getting coordinates to set mousepointer

5. Getting Mouse Coordinates

6. Getting menu coordinates

7. Getting coordinates of a Node in a TreeView

8. Getting Mouse Coordinates From Click event

9. getting mouse coordinate when moving over a form

10. Getting Coordinates When Clicking

11. Getting menu coordinates

12. Getting menu coordinates

 

 
Powered by phpBB® Forum Software