简体   繁体   中英

GMLib move existing marker

Using GMLib on Delphi XE-7, I'm trying to move existing marker to new position, I have created only one marker on the map and tried using code below as a test to move it.

procedure TfrmMapClient.GMMap1Click(Sender: TObject; LatLng: TLatLng; X, Y:   Double);
begin

mcnt := gmmarker1.count;
gmmarker1.Items[0].Position:= LatLng;

end;

but getting Exception Access Violation. Any help much appreciated

Try with

gmmarker1.Items[0].Position.Assign(LatLng);

or assigning individual properties

gmmarker1.Items[0].Position.Lat := LatLng.Lat;
gmmarker1.Items[0].Position.Lng := LatLng.Lng;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM