AntView equivalent to document.getElementById("info").innerHTML - Printable Version +- Antwise community forums (https://forums.antwise.com) +-- Forum: Antview (https://forums.antwise.com/forumdisplay.php?fid=11) +--- Forum: Antview for Windows (https://forums.antwise.com/forumdisplay.php?fid=12) +--- Thread: AntView equivalent to document.getElementById("info").innerHTML (/showthread.php?tid=189) |
AntView equivalent to document.getElementById("info").innerHTML - prshope - 2024-03-07 HI, Looking for the correct way to do with AntView [VFP sample]: m.xString = THISFORM.oleIE.document.getElementById("info").innerHTML Tried but failed with variants such as: m.xString = THISFORM.oleIE.document.RequestElementInnerTextById("info") m.xString = THISFORM.oleIE.document.RequestElementInnerHTMLById("info") Hope someone knows! RE: AntView equivalent to document.getElementById("info").innerHTML - wila - 2024-03-09 Hello prshope, You're close, but it needs a few changes. First a bit of background. The issue is that a lot of the methods in WebView2 are asynchronous, so when you query for some data, you basically just request the control "Hey, can I have this and that".. The control will then respond to that request via an event. It is natural for a lot of the modern languages and for a web interface where it can take a little while before the request is processed. For our beloved legacy languages however it is far from natural and it can become a bit painful to do simple things like getting the innerHtml of an element. This is where the old browser control helped us a lot. So in your code if you issue the RequestElementInnerHtmlById method.. then you have to go and get the result in the OnRequestElementInnerHtmlById event. That’s not very convenient in VFP (and many other legacy languages) so there’s a synchronous alternative that wraps it up in one method: RequestElementInnerHtmlByIdSync Now, how do you use this in VFP? There's a small example VFP example that comes installed with AntView under C:\users\public\documents\antview\examples\, let's use that to get started quickly. In the main form change the line of code to start with a different html example file: Code: thisform.oAntviewDocument = CREATEOBJECT('AntViewAx.AntViewDocument') && create the AntViewDocument and assign it to a form property So now the example will start with the SimpleCheckboxExample.html file from the antwise website. This file is extremely simple and contains the following html: Code: <!DOCTYPE html> Then add the following code to a command button: Code: LOCAL lcHtml If you press the button it will get the html from the P element and return "Please make a choice" in the message box. Note hat lcHtml in the method is a variable that needs to be passed by reference. Hope this helps. -- Wil RE: AntView equivalent to document.getElementById("info").innerHTML - prshope - 2024-03-12 Wil, Thank you very much.... The suggested approach works!! |