Table of Contents

TMS FNC TomTom — Guides

Markers

Add markers via Markers.Add and set Coordinate.Latitude, Coordinate.Longitude, and Title. Respond to marker clicks via OnMarkerClick.

Draggable markers and OnMarkerDragEnd

Make a marker draggable when the application lets the user reposition a stop, waypoint, or point of interest directly on the map instead of through a form field. Set TTMSFNCTomTomMarker.Draggable to True on the markers that represent editable data, and handle OnMarkerDragEnd on TTMSFNCTomTom to read back the final position once the user releases the marker.

procedure TForm1.ConfigureEditableMarker;
var
  LMarker: TTMSFNCTomTomMarker;
begin
  LMarker := TMSFNCTomTom1.AddMarker(52.3676, 4.9041, 'Editable stop');
  LMarker.Draggable := True;

  TMSFNCTomTom1.OnMarkerDragEnd := TMSFNCTomTom1MarkerDragEnd;
end;

procedure TForm1.TMSFNCTomTom1MarkerDragEnd(Sender: TObject;
  AEventData: TTMSFNCMapsEventData);
begin
  if Assigned(AEventData.Marker) then
    AEventData.Marker.Title := 'Moved stop';
end;

The marker exposed through AEventData.Marker is the same collection item that raised the event, so update its properties directly instead of creating or freeing a replacement marker. Leave Draggable at its default False for markers that represent fixed, non-editable locations.

Map style

Select a TomTom map style via Options.MapStyle. Use the style to match the map's appearance to the surrounding application theme or to the time of day: tmsDefault and tmsLight suit a daytime UI, tmsNight, tmsHybridNight, and tmsLabelsNight suit a dark UI, and the hybrid styles overlay road data on imagery when the underlying terrain matters. See TTMSFNCTomTomMapStyle for the full list of available values.

procedure TForm1.ApplyNightHybridStyle;
begin
  TMSFNCTomTom1.Options.MapStyle := tmsHybridNight;
end;

Set Options.MapStyle before the map is first shown when the application already knows which theme it needs, or change it at runtime — for example alongside an application-wide dark mode toggle — to keep the map style and the rest of the UI consistent.

Polylines and polygons

Use Polylines.Add and Polygons.Add to add route and area overlays. Populate each element's Coordinates collection with coordinate data.

Common pitfalls

  • Do not free the marker returned in AEventData.Marker inside OnMarkerDragEnd; the Markers collection owns it.
  • Draggable only affects user interaction with the marker on the map; updating Coordinate from code still works regardless of the Draggable value.
  • Match Options.MapStyle to the application's light/dark mode so the map does not clash with the surrounding UI.

See also