Bring Marker to the Front

I have a map with markers.


I want to be able to select a marker. I have got it to make the marker larger with a different colour, but how do I bring it to the front or on top?

Thanks

Dave Craggs


Hi,


You can use the Marker.Zindex property for that.

Hmm - I troed setting zindex to WebGMaps1.Markers.Count;


This sort of worked, but some markers then did not come totally to the top. What happens if multiple markers have the same zindex?

Dave

OK - this seems to work


           // Restore preious marker and bring this marker to the front
           if FLastZoomedMarker <> nil then
              FLastZoomedMarker.Zindex := FLastZoomedMarkerZindex;
           FLastZoomedMarker := WebGMaps1.Markers;
           FLastZoomedMarkerZindex := WebGMaps1.Markers.Zindex;
           WebGMaps1.Markers.Zindex := WebGMaps1.Markers.Count;

Or rather


           // Restore previous marker and bring this marker to the front
           if FLastZoomedMarker <> nil then/
              FLastZoomedMarker.Zindex := FLastZoomedMarkerZindex;
           FLastZoomedMarker := WebGMaps1.Markers;
           FLastZoomedMarkerZindex := WebGMaps1.Markers.Zindex;
           WebGMaps1.Markers.Zindex := WebGMaps1.Markers.Count;

Right it's missing the [ i ] in FLastZoomedMarker := WebGMaps1.Markers [ i ];

Thank you for notifying the issue was resolved.

If multiple markers with the same ZIndex are added, the marker that was added last will appear on top.

Note that to avoid text between square brackets getting removed you can uncheck the Enable BBCodes checkbox under the Message box.