Is there a way to determine when an asynchronous "request" is complete for FNC Google Maps, like when the service is done getting Directions, or a Route?
Both TTMSFNCDirections and TTMSFNCGeoCoding have the methods OnRequestComplete and OnRequestsComplete, but they don't seem to trigger when the service is done.
Am I mis-understanding something here, or is there another way to determine when these asynchronous events have finished? I've played with trying to accomplish this with Tasks and TTask.WaitForAll to no avail.
Thanks
for TTMSFNCDirections, you have 2 options. You can install an anonymous callback
TMSFNCDirections1.GetDirections(c1, c2,
procedure(const ARequest: TTMSFNCDirectionsRequest; const ARequestResult: TTMSFNCCloudBaseRequestResult)
var
r: TTMSFNCDirectionsItem;
begin
if ARequest.Items.Count > 0 then
begin
r := ARequest.Items[0];
end;
end);
or you can use the OnGetDirections/OnGetDirectionsResult event
If you are using the TTMSFNCGeocoding component, you have three options:
Anonymous callback
TMSFNCGeocoding1.GetGeocoding('MyAddress',
procedure(const ARequest: TTMSFNCGeocodingRequest; const ARequestResult: TTMSFNCCloudBaseRequestResult)
var
g: TTMSFNCGeocodingItem;
begin
if ARequest.Items.Count > 0 then
begin
g := ARequest.Items[0];
c := g.Coordinate;
end;
end);
Pieter,
Thank you for the quick response. The only methods I have that you mentioned are
OnGetGeocoding and OnGetDirections.
Strangely my components are showing different Version numbers. Is this the problem?
TTMSFNCGoogleMaps V 1.2.1.0
TTMSFNCGeoCoding V 1.2.0 0
TTMSFNCDirections V 1.1.2.0
TTMSFNCRouteCalculator V 1.0.0.0