1

I am using gmlib in a delphi application and it's living up to my needs. I load markers form a table of coordinates, but now I want to replace the default marker style. Since I am doing this all in code, I don't have any gmmarker items. My code is looped simply:

gmmarker1.Add(qryPoints.FieldByName('lat').AsFloat,qryPoints.FieldByName('lon').AsFloat,address);

when I try to change the icon using:

gmmarker1.Items[0].Icon:='c:\measle.png';

I get an error 'Argument out of range'

Is it possible to change the default icon without adding an item to the marker? Or am I doing this wrong?

1 Answers1

1

The Add method of TGMMarker returns a TMarker object. You can use it to assign more properties like Icon property. However, gmmarker1.Items[0].Icon or gmmarker1[0].Icon must be work if exists any marker. Check gmmarker1.Count before

cadetill
  • 1,552
  • 16
  • 24
  • That did it, thank you. I added a variable, markers (int) and added the code: markers:=gmmarker1.Count; for markers := 0 to markers -1 do begin gmmarker1.Items[markers].Icon:='c:\fdms\measle.png'; end; – Kevin Mitchell Jan 03 '15 at 01:12