This project is read-only.

Cannot catch double click on the map

Mar 19, 2013 at 9:01 AM

I was using in my Mapwingis MFC application, the double click event from the control ( using the default Dispatch ID ). It was working fine with the release version ( 4.8) . But since I use the weekly built version ( due to the Label don't display problem) I cannot catch it anymore. I've tried to build Mapwingis from source, and same problem, also cleaning all workspace.
Is there any changes on that side in mapwingis concerning double click ? How can I handle the double click now ?

Mar 21, 2013 at 12:35 AM
This may have been broken when I fixed another issue. Any way you could send some sample code? No big deal if not, but it would speed things up if you did.

Mar 27, 2013 at 9:25 AM
Edited Mar 27, 2013 at 9:30 AM

Sorry for the delay, meanwhile we have solved the problem. It seems that firedoubleclicEvent is not called. On the double click event handler of mapwingis it's just calling the OnLbuttonClick() function.

Concerning the sample code, i can give you the way it's treated right now in our software (mfc application) :
    ON_EVENT(CMapContainer, IDC_MAP1, 1, MouseDownMap1, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
    ON_EVENT(CMapContainer, IDC_MAP1, 2, MouseUpMap1, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
    ON_EVENT(CMapContainer, IDC_MAP1, 3, MouseMoveMap1, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
    ON_EVENT(CMapContainer, IDC_MAP1, 4, FileDroppedMap1, VTS_BSTR)
    ON_EVENT(CMapContainer, IDC_MAP1, 5, SelectBoxFinalMap1, VTS_I4 VTS_I4 VTS_I4 VTS_I4)
    ON_EVENT(CMapContainer, IDC_MAP1, 6, SelectBoxDragMap1, VTS_I4 VTS_I4 VTS_I4 VTS_I4)
    ON_EVENT(CMapContainer, IDC_MAP1, 7, ExtentsChangedMap1, VTS_NONE)
    ON_EVENT(CMapContainer, IDC_MAP1, 8, MapStateMap1, VTS_I4)
    ON_EVENT(CMapContainer, IDC_MAP1, 9, OnDrawBackBufferMap1, VTS_I4)

void CMapContainer::DblClickMap1()
    TRACE("Handling double click on map");
     /* rest of code */
Mar 27, 2013 at 1:28 PM
This is interesting. I'm surprise that you were ever able to get the DblClick call since MapWinGIS does not explicitly do anything with the double click. I mean to say, there was never any code calling the firedoubleclickevent. Furthermore, that call doesn't even exist which is odd.

I'm gonna investigate adding true support for double click. The goal is to end up with functionality similar to single click. You will have to set SendMouseDoubleClick to TRUE to get the call back, but the new function will also give extra information like the MouseDown event does (button clicked, control keys, etc).
Mar 27, 2013 at 3:33 PM
Edited Mar 27, 2013 at 3:43 PM
Ok, when we investigated we didn't found anything that changed on that side, our implementation of the double click event didn't change in the last 2 years, we are using it since 4.6, and we found the problem just after using the mapwingis built for solving the "Label don't display" problem...

It would be great to catch Double Click event as you say.

Do you know if there is any plan to handle middle mouse button as panning for example ? I mean affecting a mapwingis function such as panning/ selecting etc... to the middle mouse down, most GIS solutions uses this function (QGis, Esri ...) ?

Mar 31, 2013 at 1:34 AM
Alright, I think I have an intermediate solution for you. You can add:

and maybe

to the message map of your CMap class. These still get triggered even though the DISPID_DBLCLICK event no longer does.

I'm still investigating adding true double click support, but I don't want you to be stuck while I'm figuring out if that is possible.

Not sure about panning with the middle button. I know that is a standard feature for most GIS solutions, and I personally like it better than the current implementation also. We'll just have to see how things go. It might be worth filing a request for this feature.

Mar 31, 2013 at 10:16 PM
So I spent some more time testing, and I was able to remove the double click handlers from MapWinGIS without any adverse effects. When I originally added them, it was to prevent the map from jumping when double clicking pan mode. Since then, I added some extra error checking related to mouse clicking that also prevents the map from jumping.

All this means that if you get the latest code from the repo, your original double click event should work. Hope it works for you.