Jump to content

andyhill

uniGUI Subscriber
  • Posts

    1258
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by andyhill

  1. I will need to use my API_KEY, please show me how to add the Api_Key (https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap) to the following code below (thanks):- UniSession.AddJS('var gm = googleMap; '+ 'if (typeof gm == "object") '+ '{ '+ ' gm.setCenter(new google.maps.LatLng('+LatStr+','+LongStr+')); '+ ' gm.setZoom('+ZoomStr+'); '+ ' var myLatLng = {lat: '+LatStr+', lng: '+LongStr+'}; '+ ' var circle = new google.maps.Circle '+ ' ( '+ ' { '+ ' strokeColor: ''#FF0000'', '+ ' strokeOpacity: 0.8, '+ ' strokeWeight: 2, '+ ' fillColor: ''#FF0000'', '+ ' fillOpacity: 0.02, '+ ' map: gm, '+ ' center: myLatLng, '+ ' radius: 300 '+ ' } '+ ' ); '+ '} ' );
  2. While I await for a work around for iPhone (VERY URGENT) I can continue to develop for Desktop. Can you be so kind as to show me how to add a UniGUI Google Maps 'click' Listener and corresponding 'click' Handler so I can reverse geocode the Lat / Long where ever I click on the map - thanks. UniSession.AddJS('var gm = googleMap; '+ 'if (typeof gm == "object") '+ '{ '+ Google Maps 'click' Listener for reverse geocode goes here ... procedure ... begin if SameText(EventName, 'click') then begin lat:= Params.Values['lat'] lng:= Params.Values['lng'] ...
  3. Farshad, your very own example FAILS on iOS, just run your example on iOS (I have tested it on iPhoneX, iPhone7, iPad and they all fail).
  4. Two things:- 1) Is there an easy way to determine if https ? 2) Google Maps works on Desktop but fails on iPhone with ajax error "Can't find variable: google" ? Any ideas ?
  5. No Go. I abandoned all my code and went back to your code only to find out that I did not have uniGUIVars in my uses clause - Can you advise how to place Pin - thanks
  6. I have in the URLFrame ExtEvents:- function afterupdatehtml(sender, eOpts) { var latlng = new google.maps.LatLng(0.0, 0.0); var myOptions = { zoom: 1, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var umap = document.getElementById("uni_map_canvas"); var map = new google.maps.Map(umap, myOptions); googleMap = map; ajaxRequest(GPSmForm.URLFrame, 'loaded', []); // Tried here as well google.maps.event.addListener(map, 'zoom_changed', function() { GPSmForm.Zoom.setValue(this.getZoom()); } ); google.maps.event.addListener(map, 'tilesloaded', function(e) { ajaxRequest(GPSmForm.URLFrame, 'loaded', []); // Never fired } ); } ... // 'loaded' Never Fired ? procedure TGPSmForm.URLFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var LatStr, LongStr, s: String; begin if SameText(EventName, 'loaded') then begin if LoadedFlag = False then begin LoadedFlag:= True; LatStr:= Format('%2.4f', [uniMainModule.GpsLat]); LatStr:= StringReplace(LatStr, ',', '.', [rfReplaceAll]); LongStr:= Format('%2.4f', [uniMainModule.GpsLng]); LongStr:= StringReplace(LongStr, ',', '.', [rfReplaceAll]); // UniSession.AddJS('var gm=googleMap; '+ 'if (typeof gm=="object") '+ '{ '+ ' gm.setCenter(new google.maps.LatLng('+LatStr+','+LongStr+')); '+ ' gm.setZoom(17);'+ '}'); end; end; ...
  7. Tried all that, on https I still get Access Denied with URL frame. I logged all the errors above, please advise - thanks
  8. I changed the mobile HTMLFrame to a URLFrame and get the following error "Access Denied" error on http so will try on https and advise.
  9. Firstly I would like to pass a comment to the UniGUI team, the more I work with UniGUI the more I love it - thank you. It is a interesting learning curve from Delphi to UniGUI - again thanks for your patience. Now the question at hand:- I have some JS below that will interrogate the mobile GeoLocation services (under https) and return the Lat/Long if available - all good. What I have done instead of the Alert(Lat/Long), I am sending an ajax request with the Lat/Long data so I can listen for the ajax event (via PDFmForm.PDFFrame) and then call Google Maps via GPSmForm - please advise how to format the URL with ALL the positional data - thanks. // Get Lat/Long procedure TPDFmForm.UnimFormTitleButtonClick(Sender: TUnimTitleButton); begin case Sender.ButtonId of 0 : begin // Seperator end; 1 : begin UniSession.AddJS( 'navigator.geolocation.getCurrentPosition'+ '( '+ 'function(position)'+ '{ '+ // ' alert("Your latitude: " + [position.coords.latitude] + ", longitude: " + [position.coords.longitude]); '+ // removed alert and sent an ajax request with Lat/Long instead ' ajaxRequest(PDFmForm.PDFFrame, "_GeoLocation" ,' + ' ["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 ' + ' ]);' + '} '+ ', '+ 'function(error)'+ '{ '+ ' switch(error.code) '+ ' { '+ ' case 0: '+ // UnKown ' alert(error.message); '+ ' break; '+ ' case 1: '+ // Denied ' alert(error.message); '+ ' break; '+ ' case 2: '+ // UnAvailable ' alert(error.message); '+ ' break; '+ ' case 3: '+ // TimeOut ' alert(error.message); '+ ' break; '+ ' } '+ '} '+ ') ' ); ... // Listen for Lat/Long Request procedure TPDFmForm.PDFFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if SameText(EventName, '_GeoLocation') then begin // Make available to GPSmForm UniMainModule.GpsLat:= StrToFloat(Params.Values['lat']); UniMainModule.GpsLng:= StrToFloat(Params.Values['lng']); // GPSmForm.ShowModal; end; end; ... // Call Google Maps procedure TGPSmForm.UnimFormShow(Sender: TObject); var LatStr, LongStr, s: String; begin LatStr:= Format('%2.4f', [uniMainModule.GpsLat]); LatStr:= StringReplace(LatStr, ',', '.', [rfReplaceAll]); LongStr:= Format('%2.4f', [uniMainModule.GpsLng]); LongStr:= StringReplace(LongStr, ',', '.', [rfReplaceAll]); // HTMLFrame.HTML.Clear; s:= 'https://www.google.com.au/maps/@'+LatStr+','+LongStr+',10z'; HTMLFrame.HTML.Add(s); // I need formatted URL for Google Maps with all of the Lat/Long info from position ERROR Desktop: "Cannot Read Property 'First Child' Of Null" ERROR Mobile: "Cannot find variable google" - is this in addition to above a UniServerModule Custom Files issue "http://maps.googleapis.com/maps/api/js?sensor=false"?
  10. andyhill

    SSL Issue

    This is what I learned. 1) GoDaddy defaults Certificate Length to 2yrs so requesting 365 days failed for me. 2) GoDaddy rsa must be 2048, 1024 failed for me. 3) openssl.exe req -new -newkey rsa:2048 -nodes -keyout key.pem -out req.csr Once processed and granted. if SSLFlag = True then begin if FileExists(UniServerModule.StartPath + 'Root.crt') = True then begin if FileExists(UniServerModule.StartPath + 'Cert.crt') = True then begin if FileExists(UniServerModule.StartPath + 'Key.pem') = True then begin SSL.SSLOptions.RootCertFile:= UniServerModule.StartPath + 'Root.crt'; SSL.SSLOptions.CertFile:= UniServerModule.StartPath + 'Cert.crt'; SSL.SSLOptions.KeyFile:= UniServerModule.StartPath + 'Key.pem'; // Possible UniGUI Bug - file must have .pem extension - same file contents with .crt extension fails if Trim(SSLPassword) <> '' then begin SSL.SSLPassword:= SSLPassword; end; SSL.SSLPort:= SSLPort; SSL.Enabled:= True; end; end; end; end;
  11. andyhill

    SSL Issue

    Yes, my ISP did the cert request for me with the info you suggested in the UniGUI docs. I have asked him to confirm if he did everything required, this is what I sent him (xxxxxxxxx is the domain name):- openssl.exe req -days 365 -nodes -newkey rsa:1024 -keyout xxxxxxxxx-key.pem -out xxxxxxxxx-cert.pem Waiting for his reply ...
  12. andyhill

    SSL Issue

    I have purchased a Digital Certificate from GoDaddy but cannot get it to work. Request: openssl.exe req -new -key nnnnn.nnn.key -out nnnnn.csr Files Validated (all in text format): Root Cert Key https://nnnnn.nnnlocks up and fails to work ? Please advise how to resolve - thanks.
  13. Is it possible that a Zoom event is interrupted by a Pan event (or visa versa), in other words there is no logic to prevent re-entry while executing ?
  14. I believe it relates to Flex. Assume we have 10 lines of text. Memo Component Canvas size and Memo Lines Displayed are not the same and if the text exceeds the Line Display area then text is cut off half way through the text. On Desktop a small vertical scrollbar is shown (not so with mobile). Either way I want to specify the number of Lines to Display -or- have display text lines fill the canvas area if applicable. --------------------------------------------- - text - - text - - text - - - - - - - - - - - - - - - - - ---------------------------------------------
  15. On iPhone it happens without rotating but is related to zooming and panning.
  16. No, Visibility is determined by user action (Form already created with all Title Buttons set to different visibility states).
  17. With my Mobile Form OnShow Event I want to selectively Hide or Show particular Title Buttons (buttonid 1 in this case), my code below has no effect - please show me how - thanks. for i:= 0 to PDFmForm.TitleButtons.Count - 1 do begin if i = 1 then begin if UniMainModule.PdfEmailFlag = True then begin PDFmForm.TitleButtons.Visible:= True; end else begin PDFmForm.TitleButtons.Visible:= False; end; end; end;
  18. I have a TunimMemo which defaults to displaying 2.5 lines of text - how do I set the Viewing Text Canvas Height (height, flex and config.minHeight does not change it) ?
  19. As mentioned, it is not code specific nor pdf specific, knock up any mobile PdfFrame and load any PDF file and zoom / pan all over the place and it will crash.
  20. It makes no difference whether it is one page of text, one page of image, many pages of text or many pages of images. Platform: iPhoneX, iOS 11.2.1, Safari I have seen the same problem on Android (I will endeavor to get version).
  21. I do not have the phone with me (a visitor's) but it was the default browser as she has never changed it - as per new. I will try and investigate.
  22. My testing has shown uniGUI does not work on Windows Mobile Phone ver 8 - any comments ?
  23. I am using the Mobile PdfFrame and when displaying a PDF file containing an image of approx 800 x 800..1600 I get random errors during panning and zooming:- "webkit error" "a problem repeatedly occurred" "error encountered" etc. In all occasions it takes out the current session. Sometimes it shows in safari as a warning that the site is faulty. Please advise how to resolve. To test simply build a similar PDF and pan and zoom on iPhone.
×
×
  • Create New...