Marker Label

Ask


i use Marker.MapLabel.text

I want marker.maplabel.text when clicked out and when clicked back hidden
in the event no parameters are declared hide or show
is there any solution for me

This sample will add a marker on double click and when the marker is clicked, it will show/hide a marker label:


procedure TForm3.WebGMaps1MapDblClick(Sender: TObject; Latitude,
  Longitude: Double; X, Y: Integer);
begin
  webgmaps1.Markers.Add(latitude, longitude);
end;

procedure TForm3.WebGMaps1MarkerClick(Sender: TObject; MarkerTitle: string;
  IdMarker: Integer; Latitude, Longitude: Double; Button: TMouseButton);
var
  mrk: TMarker;
begin
  mrk := webgmaps1.Markers.FindItemID(idMarker) as TMarker;

  if mrk.MapLabel.Text = '' then
    mrk.MapLabel.Text := 'New marker label'
  else
    mrk.MapLabel.Text := '';

  webgmaps1.UpdateMapMarker(mrk);
end;
I have a lot of marker that is in webgmaps
all available labels, but how to keep the label in accordance with the marker

In the TMapLabel class there is only the Text setting for this, so when you use this, the label will always be visible. To solve this, you could manage these maplabel values in a separate TStringList or in an object that you assign to Marker.Tag