Expose "tilesloaded" event in TTMSFNCGoogleMaps

I'm using Embarcadero RAD Studio v12 (Delphi), and the TTMSFNCGoogleMaps to show maps in my program. I want to monitor the GoogleMaps event, "tiltesloaded", so that I wait long enough for all the image tiles to load before I continue with my app functionality. How can I get this event to trigger somehow in Delphi, either through a new event or maybe the "TTMSFNCGoogleMaps.CustomEvent" event?

Hi,

In the online documentation the Sample 3 from the Cusomization section shows how the usage for adding a custom event.

However this is a good suggestion and we'll investigate if the OnTilesLoaded event can be exposed in a future version of the TTMSFNCGoogleMaps component.

The sample you suggested is not going to work for what I want to do, I did manage to create my own solution using a custom bridge. Here's my code if you want to use it as a starting point to improve the component.

procedure TGoogleMaps.WmapMapInitialized(Sender: TObject);
begin
// Create the GoolgMaps Event Object
FMyBridgeObj := TMyBridgeObject.Create;
var MyBridgeCode : string := Wmap.GetBridgeCommunicationLayer('MyBridge');
Wmap.ExecuteJavaScript(MyBridgeCode);
Wmap.AddBridge('MyBridge', FMyBridgeObj);
var JS : string :=
'google.maps.event.addListener(map, "tilesloaded", function() {' +
' sendMyBridgeObjectMessage(''OnTilesLoaded'');' +
'});';
Wmap.ExecuteJavaScript(JS);
end;

TMyBridgeObject = class(TInterfacedPersistent, ITMSFNCCustomWebBrowserBridge)
private
function GetObjectMessage: string;
procedure SetObjectMessage(const Value: string);
public
FMapLoaded : boolean;
published
property ObjectMessage : string read GetObjectMessage write SetObjectMessage;
end;

function TMyBridgeObject.GetObjectMessage: string;
begin
end;

procedure TMyBridgeObject.SetObjectMessage(const Value : string);
begin
if (LowerCase(Value) = 'ontilesloaded') then FMapLoaded := true;
end;