JavaScript Editor js editor     Web development 

Main Page

ActiveX controls are objects with encapsulated functionality and exposed properties, events, and methods. ActiveX controls provide a wide range of functionality that you can easily tap into. ActiveX controls that ship with Visual FoxPro include:

ActiveX controls are versatile because you can subclass them to create other controls and you can control them by using the events, methods, and properties associated with the controls. You cannot create ActiveX controls with Visual FoxPro; however, you can create them using the Microsoft OLE Custom Control Developer's Kit provided with Microsoft Visual C++В® 4.0, and with the Microsoft Visual BasicВ® Control Creation Edition version 5.0.

For more information about accessing ActiveX controls, see Extending Visual FoxPro with External Libraries. For more information on creating ActiveX controls specific to Visual FoxPro, see Accessing the Visual FoxPro API.

Adding ActiveX Controls to a Form

ActiveX controls in Visual FoxPro must be contained in an OLE Container control (the base class is OLEControl). When you add an OLE Container control to a form, you can choose the ActiveX control you want to add to the form.

To add an ActiveX control to a form

  1. From the Form Controls toolbar, choose OLE Container Control and drag it to size in the form.

  2. In the Insert Object dialog box, choose Insert Control.

  3. In the Control Type list, select the desired ActiveX control.

  4. Choose OK.

If an ActiveX control supports simple data binding, Visual FoxPro will expose a ControlSource property for the control. All you have to do is set the ControlSource property to a table field and the value displayed in the ActiveX control reflects that value in the underlying field. Changes to the value in the control are saved to the field.

For examples of using ActiveX controls, run in the Visual FoxPro ...\Samples\Solution directory.

To ensure all ActiveX control events are processed, set the AutoYield property of the Visual FoxPro Application object to false (.F.).

See Also

JavaScript Editor js editor     Web development