ThinkGeo.com    |     Documentation    |     Premium Support

How to handle MapDoubleClick events

Two questions about map click events:


1) What's the best way to handle MapDoubleClick events?  I'd like to get the Wold Coordinates (in DecimalDegrees)  where the user clicked on the WinformsMap control.  I've successfully used the WinformsMap.MapClick event in the past.  However there doesn't seem to be an analogous one for DoubleClick


2) What's the best way to programatically generate these map click events.  I'd like to create a unit test to very that my handlers are working properly.



Nate,


Thanks for your post and questions.
 
1)If you use the event from Control done by .net automaticlly, you probablly cannot get the coordinate easily.

winformsMap1.DoubleClick += new EventHandler(winformsMap1_DoubleClick);

 
Try use the event in ExtentOverlay, there is a bug in its eventargs showing information, we have fixed and it should be avaiable in the next public release during the next two days, please keep an eye on it.

winformsMap1.ExtentOverlay.MapMouseDoubleClick += new EventHandler<MapMouseDoubleClickInteractiveOverlayEventArgs>(ExtentOverlay_MapMouseDoubleClick);

 
2)The MapClick event will happens when MouseDown and MouseUp both happens on the MapControl and should be almost sequently(SystemInformation.DoubleClickTime). If I mouse down and then wait the time exceeding the give metric time, it will only call the MouseDown and MouseUp.
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Hey Yale, can you give us an example of how to get the screen and world coordinates using the winformsMap1.DoubleClick event? I tried using the ExtentOverlay.MapMouseDoubleClick event and as you’ve stated, the arguments come across with zero screen X/Y. I would like to capture the double-click so I can display a context menu… 
  
 Thanks!

Greg, 
  
   Maybe I can help.  I just types up this code from a previous post.  I hope it helps. 
  
 PointShape worldSearchPoint = ExtentHelper.ToWorldCoordinate(currentExtent, screenSearchPoint, mapWidth, mapHeight); 
  
 David

I tried to use the ExtentOverlay before starting this thread, and got the same results as Gregory. 
  
 The MapMouseDoubleClickInteractiveOverlayEventArgs screen x/y is uninitialized.   This must be the bug that Yale referred to earlier.

Thanks, guys. I guess I would have to pull the mouse coordinates, convert them into ScreenX/ScreenY coordinates on the map, and then follow David’s approach to convert them to world coordinates. I’ll give it a try!

Nate, 
  
   Were the world coordinates wrong or not there?  If they were good we can go from world to screen coordinates. 
  
 David

In my ExtentOverlay_MapMouseDoubleClick event, the MapMouseDoubleClickInteractivOverlayEventArgs.InteractionArguments property has zero values for ScreenX, ScreenY, WorldX, WorldY, MapHeight, MapWidth, etc. Is this the bug you’re alluding to, or am I missing a step?

Guys,  
  
 I am sorry to say that this is a bug in last public release(3.0.453) which will cause the values in the event args 0, and it has been fixed in 3.1.299.  We will have this release out(3.1.299)  very soon.  
  
 Sorry for the inconvinience now. 
  
 Thanks. 
  
 Yang