Edge control doesn't work on first call

pdanes

Registered User.
Local time
Yesterday, 18:45
Joined
Apr 12, 2011
Messages
233
Title pretty much says it all. I have an Edge Browser control on a pop-up form opened in dialog mode. It is supposed to show a map, using an OSM Leaflet. When the app opens, the first instance of opening the subform shows nothing. I've put debug print statements in the form's Load event, and all values seem to be getting populated properly, but the control shows nothing. Closing the form and reopening it displays properly, as do all subsequent calls. Closing the app and re-opening it again seemingly 'works', but the control shows nothing on the first call.

I've tried using the Navigate method instead of loading the control source - same result. I have not found this problem reported anywhere. I have found many reports of the control not working, and solutions to such problems, but nobody saying that it fails only on the first call.

This is the code in the load event.
Code:
Private Sub Form_Load()
Debug.Print EdgeBrowser.ControlSource
'EdgeBrowser.Navigate "https://msaccess/" & fs.GetSpecialFolder(2) & "\SavceGPSMapa.html"
EdgeBrowser.ControlSource = "https://msaccess/" & fs.GetSpecialFolder(2) & "\SavceGPSMapa.html"
DoEvents
Sleep 100
DoEvents
'Fix for the MWBC not properly loading dynamic Control Source
Do While EdgeBrowser.ReadyState <> acComplete
    Debug.Print EdgeBrowser.ControlSource; EdgeBrowser.ReadyState
    Sleep 100
    DoEvents
Loop
Debug.Print EdgeBrowser.ControlSource; EdgeBrowser.ReadyState
cmdKonec.SetFocus
End Sub

Here is a sample of the generated HTML code for loading into the browser control.
HTML:
<!DOCTYPE html>
<html lang='en'>
<!-- saved from url=(0016)http://localhost -->
<head>
<base target='_top'>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Ukázka bodů</title>
<link rel='shortcut icon' type='image/x-icon' href='docs/images/favicon.ico'/>
<link rel='stylesheet' href='https://unpkg.com/leaflet@1.9.4/dist/leaflet.css' integrity='sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=' crossorigin=''/>
<script src='https://unpkg.com/leaflet@1.9.4/dist/leaflet.js' integrity='sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=' crossorigin=''></script>
<style>html, body {height: 100%; margin: 0;}</style>
</head>
<body>
<div id='map' style='width: 100%; height: 100%;'></div>
<p id = 'demo' style='display:none'>Mike</p>
<script>
const map=L.map('map').setView([49.6388864, 15.6005139], 8);
const tiles=L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {maxZoom: 19}).addTo(map);
L.marker([48.8384849990001,14.2424339000001]).addTo(map).bindPopup('Nyctalus noctula - <b>220415</b>');
L.marker([48.8420128100001,14.2320306100001]).addTo(map).bindPopup('Myotis daubentonii - <b>151644</b>');
L.marker([49.0043788880001,14.7878130540001]).addTo(map).bindPopup('Sciurus vulgaris - <b>220531</b>');
L.marker([49.0409703090001,14.4214908100001]).addTo(map).bindPopup('Nyctalus noctula - <b>150766</b>');
L.marker([49.0882128100001,14.8604953080001]).addTo(map).bindPopup('Sciurus vulgaris - <b>220551</b>');
L.marker([49.1390258200001,14.7162528180001]).addTo(map).bindPopup('Myotis daubentonii - <b>148863</b>');
L.marker([49.1443806090001,14.7137853100001]).addTo(map).bindPopup('Myotis daubentonii - <b>148865</b>');
L.marker([50.5254777990001,13.9637300000001]).addTo(map).bindPopup('Glis glis - <b>221472</b>');
var elementID;
function onMapClick(e) {
document.getElementById('demo').innerHTML = e.latlng;
elementID=L.marker([e.latlng]).addTo(map).bindPopup('New');
}
map.on('click', onMapClick);
</script>
</body>
</html>
 
Suggest reset the control source to zls before assigning the new file
Bullseye! That fixed it - just tried ten times in a row, selection sets both large and small, and 100% success on first opening. Many thanks.
 

Users who are viewing this thread

Back
Top Bottom