Page 1 of 1

How to exchange data between web client and FW

Posted: Thu Jul 22, 2021 4:20 am
by Otto
Dear Antonio,
can you please show me how I can exchange data between web part and FW?
Thank you in advance
Otto


Code: Select all | Expand


#include "FiveWin.ch"

function Main()

   local oWnd, oWndChild, oActiveX, oDk
   
   DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support" MDI
   DEFINE WINDOW oWndChild MDICHILD OF oWnd
    oActiveX = TActiveX():New( oWndChild, "Shell.Explorer" )

   oWndChild:oClient = oActiveX // To fill the entire window surface
   oWndChild:Resize()

   oActiveX:Do( "Navigate2", "c:\fwh_2021\samples\button1.html" )
   ? "wait"
    oDk := oActiveX:GetProp("Document")
   oActiveX:bOnEvent = { | event, aParams, pParams |   EventInfo( event, aParams, pParams, oActiveX, oDk )    }

   ACTIVATE WINDOW oWnd  

return nil

function EventInfo( event, aParams, pParams, oActiveX, oDk )
   local buf := ""
   local cShow := ""

   do while .T.
      if valtype(oDk:body)!="U"
         if oDk:body:ReadyState="complete"
            sysrefresh()
            buf :=  oDk:getElementById("demo"):InnerHTML  
            if len(alltrim(buf)) > 0
               cShow := buf
               oDk:getElementById("demo"):InnerHTML := ""
               buf := ""
               ? cShow
            endif
            exit
         endif
      endif
      sysrefresh()
   enddo

return  
 


button1.html

Code: Select all | Expand


<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

</head>
<body>

<h2>Login Form</h2>

 
  <div class="container">
    <label for="uname"><b>Username</b></label>
    <input id="name1" type="text" placeholder="Enter Username" name="uname" required>

    <label for="psw"><b>Password</b></label>
    <input type="password" placeholder="Enter Password" name="psw" required>
       
     <button onclick="myFunction()">Click me</button>
    <label>
      <input type="checkbox" checked="checked" name="remember"> Remember me
    </label>
  </div>
 
 
<p id="demo"></p>


<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>
 

</body>
</html>

 

Re: How to exchange data between web client and FW

Posted: Thu Jul 22, 2021 1:55 pm
by Natter
I did it like this:
1. Open the page in ActiveX (IE) and get the document
2. Upload an HTML file in which I specify the general variables document.DefaultView. aa=0 ;
document.DefaultView. bb="" ;
document.DefaultView. cc=123 ;
and page processing scripts.
These variables are visible in both WEB and FW

Re: How to exchange data between web client and FW

Posted: Thu Jul 22, 2021 2:24 pm
by Otto
Hello Natter,
thank you.
Can you please show some code?
Do you mean you store the file and read it again from FW?

Best regards,
Otto

Re: How to exchange data between web client and FW

Posted: Thu Jul 22, 2021 2:32 pm
by Natter
I didn't understand the question !
I'm not saving anything to a file. Am I just working with a common WEB page and FW

Re: How to exchange data between web client and FW

Posted: Fri Jul 23, 2021 6:02 am
by Antonio Linares
Dear Otto,

You can do it using the new Class WebView from Cristobal :-)

Re: How to exchange data between web client and FW

Posted: Fri Jul 23, 2021 8:48 am
by leandro
Antonio buenos días,

Cuando será publicada la nueva clase WebView creada por el Master Cristobal? :D

Re: How to exchange data between web client and FW

Posted: Fri Jul 23, 2021 10:04 am
by Otto
Dear Antonio,

Querying the INPUT form from FIVEWIN works. But what does not work is to navigate the form with the keyboard.
Is that a problem with web control? When I open the HTML page in Internet Explorer, the navigation works - but not with activeX.

Best regards,
Otto

Re: How to exchange data between web client and FW

Posted: Fri Jul 23, 2021 10:45 am
by Antonio Linares
Dear Otto,

Cristobal is the right one to explain what can be done with his new class