TdxAzureMapGeolocationProviderOnResponse Type
The procedural type for Azure Maps Geolocation server response events.
#Declaration
TdxAzureMapGeolocationProviderOnResponse = procedure(ASender: TdxMapControlAzureMapGeolocationProvider; AResponse: TdxAzureMapGeolocationRequestResponse; var ADestroyResponse: Boolean) of object;
#Parameters
Name | Type | Description |
---|---|---|
ASender | Tdx |
Provides access to the Azure Maps Geocode information component that raised the server response event. |
AResponse | Tdx |
Provides access to a container populated with information returned by a server. |
ADestroy |
Boolean | Specifies if the response event handler automatically destroys the information container accessible through the
|
#Remarks
Response events allow you to receive and process a server response after an asynchronous query.
#Code Example: Obtain Country ISO Code by IP Address Asynchronously
The code example in this section demonstrates a procedure that sends a query to an Azure Maps Geolocation server and an OnResponse event handler that receives and processes the server response.
uses
dxAzureMapInformationProviders, // Declares TdxMapControlAzureMapGeolocationProvider
dxMessageDialog; // Declares the dxMessageDlg global function
// ...
procedure TMyForm.SendGeolocationQuery(const AIPAddress: string);
var
AQueryParams: IdxAzureMapGeolocationQueryParams;
begin
AQueryParams := dxMapControl1AzureMapGeolocationProvider1.CreateQueryParams;
AQueryParams.IP := AIPAddress;
dxMapControl1AzureMapGeolocationProvider1.ExecuteAsync(AQueryParams);
end;
procedure TMyForm.dxMapControl1AzureMapGeolocationProvider1Response(
ASender: TdxMapControlAzureMapGeolocationProvider;
AResponse: TdxAzureMapGeolocationRequestResponse; var ADestroyResponse: Boolean);
begin
if AResponse <> nil then
begin
if AResponse.IsSuccess then
dxMessageDlg('Country Code: ' + AResponse.CountryRegion.IsoCode, TMsgDlgType.mtInformation, [mbOK], 0);
else if Assigned(AResponse.ErrorInfo) then
dxMessageDlg(AResponse.ErrorInfo.Message, TMsgDlgType.mtError, [mbOK], 0);
end;
end;
#Direct TdxAzureMapGeolocationProviderOnResponse Type Reference
The TdxMapControlAzureMapGeocodeProvider.OnResponse event references the TdxAzureMapGeolocationProviderOnResponse
procedural type.