ElCherchu Posted December 4, 2021 Share Posted December 4, 2021 Hi programers. I having the error as show below when I try to delete a Marker. I'm coding UniMap1.Markers.Delete(Trunc(UniNumberEdit4.Value)); And Argument out of rage error raise. Who can help me? Thank for your help. Quote Link to comment Share on other sites More sharing options...
zhyhero Posted December 4, 2021 Share Posted December 4, 2021 Marker.Delete(Index:integer); Index<>aMarker.ID Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted December 4, 2021 Share Posted December 4, 2021 12 hours ago, ElCherchu said: Hi programers. I having the error as show below when I try to delete a Marker. I'm coding UniMap1.Markers.Delete(Trunc(UniNumberEdit4.Value)); And Argument out of rage error raise. Who can help me? Thank for your help. Hello Please use below code. procedure TMainForm.UniButton19Click(Sender: TObject); function GetMarkerById(Id: integer): TUniMapMarker; var i: Integer; begin Result:= nil; for i := 0 to UniMap1.Markers.Count-1 do begin if UniMap1.Markers[i].Id = Id then begin Result := UniMap1.Markers[i]; Exit; end; end; end; begin GetMarkerById(Trunc(UniNumberEdit4.Value)).RemoveFromMap; end; Quote Link to comment Share on other sites More sharing options...
ElCherchu Posted December 5, 2021 Author Share Posted December 5, 2021 On 12/4/2021 at 8:59 AM, Hayri ASLAN said: Hello Please use below code. procedure TMainForm.UniButton19Click(Sender: TObject); function GetMarkerById(Id: integer): TUniMapMarker; var i: Integer; begin Result:= nil; for i := 0 to UniMap1.Markers.Count-1 do begin if UniMap1.Markers[i].Id = Id then begin Result := UniMap1.Markers[i]; Exit; end; end; end; begin GetMarkerById(Trunc(UniNumberEdit4.Value)).RemoveFromMap; end; Thank you Hayri. This works perfectly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.