7 1 7 Using an ActiveX Control

Visual LANSA

7.1.7 Using an ActiveX Control

You use ActiveX controls in your application in the same way as you use native Visual LANSA controls.

This example shows how to use the Microsoft Web Browser ActiveX control which is installed on your PC if you have Microsoft Internet Explorer.

To try out the Microsoft web browser control, create a form. In the editor open the ActiveX Controls in Resources node of the Repository tab. Locate, select and then drag and drop the VA_WEBCTL control on your form (as always, you need to have the Design tab topmost to drag and drop a control).

Now you have a form with a ready-to-use web browser on it.

Display the Source tab of your form. As you can see a DEFINE_COM definition has been added for the web browser control:

DEFINE_COM CLASS(#VA_WEBCTL.WebBrowser) NAME(#VA_WEBCTL) DISPLAYPOSITION(1) HEIGHT(200) LEFT(32) PARENT(#COM_OWNER) TABPOSITION(1) TOP(8) WIDTH(100)

The methods and events and the Visual LANSA properties of the control are now accessible in the Details tab.

From the Features window (F2) you can display a brief description of all the properties, events and methods of the control.

Note that the control has a Navigate method which displays a URL:

Add this statement to the initialize event of your form:

invoke method(#VA_WEBCTL.navigate) url(www.lansa.com)

  

To see how the browser control works, compile the form and execute it. The LANSA home page is displayed in the browser.

 

 

Ý 7.1 Using ActiveX Controls