Visual FoxPro Integration

Introduction

Visual FoxPro integrations can use either the .NET or the JavaScript SDK.

Both the .NET and the JavaScript SDK make use of the Web Browser control. By default, the Web Browser control will attempt to render any HTML as IE7. You should add the following meta tag to the <head> section of your HTML to have the control render the contenct as IE9.

<meta http-equiv="X-UA-Compatible" content="IE=9"/>

Known Issues with JavaScript and VFP

There are a couple of quirks when calling JavaScript functions from VFP. The first is that VFP translates all function calls to the browser COM object to lower case. Since JavaScript is case sensitive, this means that all functions that are going to be called from VFP have to named in all lower case. Functions that are only called by other JavaScript or HTML elements can be in normal case (i.e. they do not need to be named in all lower case). The second issue is that all function calls from VFP to JavaScript must pass at least 1 parameter, even if the JavaScript function does not take any parameters. In the latter case, the extra parameter is ignored by the JavaScript engine.

Calling VFP Methods from JavaScript

You can pass a reference to the VFP form into JavaScript once the web browser component is loaded. This reference can be used to call VFP methods from within JavaScript when specific events occur.

<button onclick="onButtonClicked(100)">Click Me</button>

<script language="JavaScript">
var oVFP = null;

// Call this function from VFP after the web browser component is loaded.
// Example: oIE.Document.Script.setvfp(THISFORM)

function setvfp(obj)
{
	oVFP = obj;
}


// To call a VFP method named JavaScriptCallBack from JavaScript:

function onButtonClicked(data)
{
	oVFP.JavaScriptCallBack(data);
}

</script>