Not getting all data
Posted: Sat Oct 15, 2022 6:40 pm
A little backround. Like so many others, I came from TWebBrowser land. I had made extensive use of the ability to call Active-X from JavaScript, client side. My client depends heavily on this, since 2014. Their entire business go around my app.
I have written a custom mapping program on Google maps. I have pattened a polygon called Quarter Minute. As its name implies, it is a polygon that measure 1/4 minute by 1/4 minute. My program allows the user to select a geographical area (fencing) and assign it to a worker. It is not unusal to assign 1500 to 2000 QtrMins to a worker(Locartor). Under TWebBrowser, I collected all the QtrMinutes in an array in Javascript and assigned to the database 1 at a time (machine gunned them) with an Active-X. It worked!
My work around is to use a File Drop. I collect all the QtrMins in an array, write them out to a text file and save them to to a folder managed by "ResultFilePath" with "Handled := true". I then catch the textfile with:
COREWEBVIEW2_DOWNLOAD_STATE_COMPLETED:
begin
StatusBar1.panels[0].Text := 'Download complete! ' + sDownloadID;
RunMethod('fileToSave.txt');
FreeAndNil(FDownloadOperation);
end;
This works beautifully. Even better than TWebBrowser.
The body of a QtrMinute file is:
SaveQtrMinutes
3449C8327C
3449C8327D
3449C8326A
3449C8326B
3449C8326C
3449C8326D
3449C8325A
3449C8325B
3449C8325C
3449C8325D
...
up to 2000 items
I have hit one glitch though. When a worker selects over ~640 QtrMins, it does nothing.
I can download 400 QtrMins over and over again. But it I block off over 640 and save, nothing happens. No exceptions, no hanging, just nothing. I see the alert but the Text file is never saved nor is "WVBrowser1DownloadStarting" triggered.
If I go back and select less QtrMins, 20 for example, it still does not work. Once it fails, it does not recover until the app is restarted.
I have run the identical HTML in WebStorm, and I can create a TextFile with over 3000 QtrMins and I can save them to a TextFile, over and over again. What is different is that I do get a Pop up "This file wants to Download Multiple files.
Is there a chance that this could be popping up (invisibly) under my app and not getting completed? I can find anything that might let me set this in the ICoreWebView2DownloadOperation interface. Actually, it is supposed to be under Settings in Edge but is no longer there.
Please help. This is an important project and my client needs this.
By the way, I have tried to donate to you. I DON'T DO PayPal. I selected Debit but it rejects the card with a PayPal has rejected your card.
I will poke around some more.
You are doing great work and should be compensated.
I have written a custom mapping program on Google maps. I have pattened a polygon called Quarter Minute. As its name implies, it is a polygon that measure 1/4 minute by 1/4 minute. My program allows the user to select a geographical area (fencing) and assign it to a worker. It is not unusal to assign 1500 to 2000 QtrMins to a worker(Locartor). Under TWebBrowser, I collected all the QtrMinutes in an array in Javascript and assigned to the database 1 at a time (machine gunned them) with an Active-X. It worked!
My work around is to use a File Drop. I collect all the QtrMins in an array, write them out to a text file and save them to to a folder managed by "ResultFilePath" with "Handled := true". I then catch the textfile with:
COREWEBVIEW2_DOWNLOAD_STATE_COMPLETED:
begin
StatusBar1.panels[0].Text := 'Download complete! ' + sDownloadID;
RunMethod('fileToSave.txt');
FreeAndNil(FDownloadOperation);
end;
This works beautifully. Even better than TWebBrowser.
The body of a QtrMinute file is:
SaveQtrMinutes
3449C8327C
3449C8327D
3449C8326A
3449C8326B
3449C8326C
3449C8326D
3449C8325A
3449C8325B
3449C8325C
3449C8325D
...
up to 2000 items
I have hit one glitch though. When a worker selects over ~640 QtrMins, it does nothing.
Code: Select all
function SaveQtrMin() {
savedQtrMinutes='';
for (var m in qtrArray) {
savedQtrMinutes =savedQtrMinutes + qtrArray[m].qtrMinute+'\n'
}
saveTextAsFile('FileNameToSave','SaveQtrMinutes'+'\n'+ savedQtrMinutes);
alert("I ran");
}
function saveTextAsFile(fileNameToSaveAs, textToWrite)
{
window.URL = window.URL || window.webkitURL;
var textFileAsBlob = new Blob([textToWrite], {type: 'text/plain'});
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.href = URL.createObjectURL(textFileAsBlob);
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
}
If I go back and select less QtrMins, 20 for example, it still does not work. Once it fails, it does not recover until the app is restarted.
I have run the identical HTML in WebStorm, and I can create a TextFile with over 3000 QtrMins and I can save them to a TextFile, over and over again. What is different is that I do get a Pop up "This file wants to Download Multiple files.
Is there a chance that this could be popping up (invisibly) under my app and not getting completed? I can find anything that might let me set this in the ICoreWebView2DownloadOperation interface. Actually, it is supposed to be under Settings in Edge but is no longer there.
Please help. This is an important project and my client needs this.
By the way, I have tried to donate to you. I DON'T DO PayPal. I selected Debit but it rejects the card with a PayPal has rejected your card.
I will poke around some more.
You are doing great work and should be compensated.