INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Specify mouse coordinates

Specify mouse coordinates

(OP)
hi all
in my form i have a control(Image).i want the code to make the left or top of this control as my mouse(left or top) in this form.how that?

RE: Specify mouse coordinates

ameedoo3000,
Do you mean, you want the top and left of the image control to appear under the mouse pointer? You mention left or top? Can you explain what you're trying to accomplish, because this doesn't make much sense to me...

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."hammer

RE: Specify mouse coordinates

(OP)
Yes I want to know the top and left place where the mouse in the form to attract the picture.

RE: Specify mouse coordinates

(OP)
i want where i click the mouse in the form the picture move to that point. how that?

RE: Specify mouse coordinates

The get the mouse coordinates put this in the mousemove event of the form:

CODE --> foxpro

LPARAMETERS nButton, nShift, nXCoord, nYCoord
MESSAGEBOX('X:'+TRANSFORM(nXCoord)+' Y:'+TRANSFORM(nYCoord)) 

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483: How to get the best response from the forum first.

RE: Specify mouse coordinates

(OP)
yes. now every thing is ok.
thank you very very much dear "Mike Gagnon".

RE: Specify mouse coordinates

But if the idea is to let the use move a picture on a form, I would recommend using Drag and Drop instead. Because with the mousemove event it will trigger anytime the user clicks on the form and may become frustrating to the user.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483: How to get the best response from the forum first.

RE: Specify mouse coordinates

I agree with Mike G about drag-and-drop. But if you really want to move the image to the current mouse co-ordinates, you can do so like this:

CODE -->

* In the form's MouseMove event
LPARAMETERS nButton, nShift, nXCoord, nYCoord
THISFORM.MyImage.Move(nXCoord, nYCoord) 

But the effect will be weird. Asa the user moves the mouse around the form, the image will simply follow it - except when the mouse moves over another control within the form. Also, there will be no way to "release" this behaviour, that is, the user won't be able to "drop" the image at its new position. Nor will they easily be able to interact with other controls on the form. Is that really what you want?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Specify mouse coordinates

(OP)
Sorry for the delay in reply.
Yes, that's exactly what I want specifically.
I am also completely convinced with your Opinion.
Thank you very very much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close