AntonioCuomo Posted December 1, 2020 Share Posted December 1, 2020 in a unigui windows application I want to insert the geolocation of the pc with the following source. procedure TMainForm.UniBitBtn1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin UniMemo1.Lines.Add(eventname); if EventName = 'CurrentPosition' then begin UniMainModule.latidu := Params['lat'].Value; UniMainModule.longi := Params['lng'].Value; if accedi(StrToInt(UniNumberEdit1.text), uniedit3.Text, UniEdit2.text) = 0 then UniForm1.ShowModal(); end; end; procedure TMainForm.UniBitBtn1Click(Sender: TObject); begin unisession.AddJS( 'if (navigator.geolocation) { ' + ' navigator.geolocation.getCurrentPosition( function(position) { ' + ' ajaxRequest(MainForm.uniBitBtn, "CurrentPosition" ,' + ' ["lat=" + position.coords.latitude, ' + ' "lng=" + position.coords.longitude, ' + ' ]);' + ' })' + '} else {alert("Geolocation is not supported.");}' ); //if accedi(StrToInt(UniNumberEdit1.text), uniedit3.Text, UniEdit2.text) = 0 then // UniForm1.ShowModal(); end; In the test procedure it works and detects the CurrentPosition event, when I transfer the source in my application unibitbtn ajaxevent detects only the click event and not CurrentPosition Link to comment Share on other sites More sharing options...
Sherzod Posted December 1, 2020 Share Posted December 1, 2020 Hello, Make a simple testcase if possible, to understand your code. Link to comment Share on other sites More sharing options...
AntonioCuomo Posted December 1, 2020 Author Share Posted December 1, 2020 Here is the project. for access matricola = 20017 and password = 12345678 Thank WebPresenze.zip Link to comment Share on other sites More sharing options...
AntonioCuomo Posted December 1, 2020 Author Share Posted December 1, 2020 This is test rin ok testgeolaction.zip Link to comment Share on other sites More sharing options...
AntonioCuomo Posted December 9, 2020 Author Share Posted December 9, 2020 after many tests I have verified that: the demo on localhost: 8100 geolocation works if I open the application from upc on the net (192.168.1.9:8100) the geolocation does not work Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now