Click on Marker Problem: Open new dialog

Topics: Windows Mobile
Nov 29, 2011 at 8:35 AM

Hello,

I want to use a marker to open a new dialog on click, which allows to enter some data related to this marker. It's a Windows Mobile device with a touch screen.

I use the OnMarkerEnter event to be notified if the user is clicking the marker. My observation is when the marker is clicked the dialog appears and I can enter my data. After the data is entered the map appears with the marker again. But now am I not able to drag anymore, only the click on the marker works. Next I click on the marker, dialog appears, and leave the dialog back to map. Now, dragging the map is possible again. If I repeat this sequence the behavior is always the same.

In the case where the map dragging is working I noticed that OnMouseMove() is called, then OnMarkerEnter() is called for the clicked marker, then OnMouseMove() is called again and Core.BeginDrag() is called, then OnMouseUp() is called and  Core.EndDrag(). After that I am in my dialog. Then I leave the dialog and dragging the map is not possible again. Then I click the same marker again. The OnMouseMove() is called, next OnMarkerEnter() is called, then OnMouseUp() is called and my dialog is opened.

The problem is that if dragging is possible first then after the click on the marker it's not any more. It requires the click on the marker again to unlock the dragging.

Is there a way to fix this strange behavior?

Nov 29, 2011 at 6:00 PM

yes, someone needs to fix it ;}

Nov 30, 2011 at 9:19 AM

here it is,

it was time consuming for me to finde the bug, but the solution is simple:

in file GMapOverlay.cs the Control.IsMouseOverMarker was not set in the Mobile version, so the original code should be changed from:

 

if(e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Reset)
         {
#if !PocketPC
            if(Control.IsMouseOverMarker)
            {
               Control.IsMouseOverMarker = false;
               Control.Cursor = Cursors.Default;
            }
#endif

 

 

to

 

 

 if (e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Reset)
         {
             if (Control.IsMouseOverMarker)
             {
                 Control.IsMouseOverMarker = false;
#if !PocketPC
                Control.Cursor = Cursors.Default;
#endif
             }
         }

 

 

I would appreciate if radioman could integrate this patch. Another request is to make DragSize.Height, DragSize.Width a configurable property. In GMapControl.cs it is set to fixed values actually for the Mobile part. I noticed that these values help to improve the handling from device to device.

 

again, thanks for the great piece of software :-)

Nov 30, 2011 at 11:22 AM

thanks, fixed

p.s. added DragSize as public filed