You are here: > ESRI Forums > mapobjects users on-line discussion forums > Thread Replies

MapObjects Users On-Line Discussion Forums

MapObjects -Windows Edition forum

Click Event vs MouseDown Event   Michael Volz Feb 12, 2001
RE: Click Event vs MouseDown Event   Brian Flood Feb 13, 2001
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Click Event vs MouseDown Event 
Author Michael Volz 
Date Feb 12, 2001 
Message Is it possible to obtain point coordinates from a Click event like you can with a MouseDown event? I tried to set up the Click event as Private Sub_Click(X As Single, Y As Single), but MO told me this is an illegal operation. Can someone help me with some sample code showing how to obtain the point coordinates where you click on the map control with the Click Event? Thank you. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject RE: Click Event vs MouseDown Event 
Author Brian Flood 
Date Feb 13, 2001 
Message Hello

I think your best bet would be to use the MouseUp event which fires just before Click. MouseUp hands you the x,y, shift and button variables just like MouseDown and will allow you to code just like Click.

I can't think of any situation where you couldn't mimic Click directly from MouseUp but if you really need it then you can use Win32 api functions to get your info. Here's a qucik overview:

To get the x,y:
Use GetCursorPos() to get the x,y values in screen coordinates
Use ScreenToClient() to convert the coords to your map hWnd's coords. Remember all api calls are in pixel so convert from pixels to twips if necessary


To get the shift key (or ctrl etc):
Use GetAsyncKeyState() and pass VK_LSHIFT/VK_RSHIFT. Pass VK_LBUTTON/VK_RBUTTON to get the mouse button states. The function return a long value that is 1 if the key/button is depressed.