1. I am using the Application Form;
2. I call the form like this:
Procedure TMainForm.aclFormatExecute (Sender: TObject);
Var frmPainel_Fornecedor: TfrmPainel_Fornecedor;
Begin
FrmPainel_Fornecedor: = TfrmPainel_Fornecedor.Create (UniApplication);
FrmPainel_Fornecedor.ShowModal;
End;
3. I used the same way, the same DEMO code, I included a UniGMap, and a button to load the code.
Button Code:
Procedure TfrmPainel_Fornecedor.UniButton1AjaxEvent (Sender: TComponent; EventName: string; Params: TUniStrings);
Var
AMarker: TMarker;
Begin
If EventName = 'CurrentPosition' then
Begin
//UniMemo1.Text: = (EventName + # 13 # 10 + Params.Text);
UniGMap1.RemoveAllMarkers;
With aMarker
Begin
Id: = 1;
Latitude: = StrToFloat (Params.Values ['lat'], MainForm.fs);
Longitude: = StrToFloat (Params.Values ['lng'], MainForm.fs);
Title: = 'Here I am!';
Animation: = maNone;
Clickable: = True;
Draggable: = False;
RaiseOnDrag: = False;
End;
UniGMap1.AddMarker (aMarker, True);
End;
End;
Procedure TfrmPainel_Fornecedor.UniButton1Click (Sender: TObject);
Begin
UniSession.AddJS (
'If (navigator.geolocation) {' +
'Navigator.geolocation.getCurrentPosition (function (position) {' +
'AjaxRequest (GeolocationAPIForm.UniButton2, "CurrentPosition",' +
'[Lat = "+ position.coords.latitude,' +
'"Lng =" + position.coords.longitude,' +
'"Acc =" + position.coords.accuracy,' +
'"Alt =" + position.coords.altitude,' +
'"Altacc =" + position.coords.altitudeAccuracy,' +
'"Head =" + position.coords.heading,' +
'"Ts =" + position.coords.timestamp' +
']);' +
(I.e.
');
End;
UniGMap, I did exactly the same settings as DEMO, copied and pasted.
It loads the map, but when doing the GeoLocation, the error that I pointed out above in the original message appears.