Classes

Class XbpActiveXControl() Foundation

Class function of the XbpActiveXControl class

Description

The class XbpActiveXControl implements a generic control container for hosting ActiveX controls. Xbase++ applications use instances of the XbpActiveXControl class to integrate ActiveX controls with their user interface and to interact with the control through the methods and instance variables introduced by this class.

An ActiveX control is an automation object that implements a windowed user interface component. An ActiveX control is roughly comparable to an Xbase Part in that it contains logic to display a visual representation and defines interfaces for communicating with the Xbase++ application. However, an ActiveX control is not created directly. Instead, the control's life cycle is managed implicitly by the automation server that exposes the interfaces of the ActiveX control.

XbpActiveXControl uses the functionality inherited from class AutomationObject to create and manage an ActiveX control requested by an Xbase++ application. Also, the class builds on the event handling mechanism introduced by its base class ActiveXObject. Internally, XbpActiveXControl implements COM interfaces required for hosting the control and maintaining its display area. Please see the documentation on class AutomationObject to learn more about automation objects and COM/ActiveX interfaces.

From the perspective of the Xbase++ application, an ActiveX control hosted by an XbpActiveXControl object behaves like a normal Xbase Part. The application communicates with the control by setting instance variables or calling methods on the XbpActiveXControl instance.

Specifically, the class XbpActiveXControl implements the following functionality:

Implicit maintenance of an ActiveX control's life cycle.
Integration of the COM events generated by an ActiveX control with the Xbase Part event protocol.
Automatic mapping of the instance variables and methods defined by class XbpWindow to the corresponding COM/ActiveX properties and methods used by the control.
Implements the COM interfaces for hosting ActiveX controls and for maintaining its display area

Using an ActiveX Control

// 
// Create a label control as a child of an 
// existing dialog. The example uses 
// a Presentation Parameter to defines the 
// label control's background color 
// 
aPP := { {XBP_PP_BGCLR, GRA_CLR_RED} } 
oLabel       := XbpActiveXControl():new( oDlg:drawingArea,{10,250},{100,80} ) 
oLabel:CLSID := "Forms.Label" 
oLabel:create( oDlg:drawingarea,,,aPP,.F.) 

// 
// Assign a code block for handling "left 
// mouse button down" events and show 
// ActiveX control 
// 
oLabel:lbDown := {|| MsgBox("Label was clicked on!")} 
oLabel:show() 

Class methods
:new()
Creates an instance of the XbpActiveXControl class.
Life cycle
:create()
Requests system resources for the XbpActiveXControl object.
:destroy()
Releases the system resources of the object.
:configure()
Reconfigures the XbpActiveXControl object after :create() has been executed.
Configuration
:useVisualStyle
Determines whether the ActiveX control uses a Visual Style for display.
:visible
Determines whether the ActiveX control is visible after :create() is called.
Connection Management
:CLSID
Class ID or ProgID identifying the COM/ActiveX component to connect to
:server
The instance variable :server contains the name of the server that is to be used for creating an ActiveX control.
:license
The instance variable :license contains the license string required for creating licensed ActiveX controls.
Status
:controlFlags
Information about type and capabilities of the ActiveX control
Runtime Data
:cancel
Specifies the ActiveX control to be the cancel button of the form.
:default
Specifies the ActiveX control to be the default button of the form.
ActiveX Control Manipulation
:setPos()
Repositions the ActiveX control.
:setSize()
Changes the size of the XbpActiveXControl.
:setPosAndSize()
Changes position and size of the ActiveX control.
:show()
Redisplays a hidden ActiveX control.
:setPointer()
Defines the shape of the mouse pointer displayed by an ActiveX control.
:setVisible()
Assigns a value to the :visible instance variable.
:setFont()
Set a new font.
:setColorBG()
Sets or returns the background color.
:setColorFG()
Set foreground color.
:setPresParam()
Sets or returns the presentation parameter array.
Control Container Presentation Parameter Management
:inheritPresParams()
Inherits presentation parameters defined by control container's parent object
:presParamChanged()
Synchronize ActiveX control container's presentation parameters
:setInputFocus()
Set the input focus on the ActiveX control.
COM/ActiveX Event Management
:subscribeStdEvents()
Registers event processing for standard ActiveX control events.
:unsubscribeStdEvents()
Deregisters standard event processing installed by :subscribeStdEvents()
Default handlers for standard COM/ActiveX events
:keyDown()
Default event handler for ActiveX control event "KeyDown" (DISPID_KEYDOWN).
:click()
Default event handler for ActiveX control event "Click" (DISPID_CLICK).
:dblClick()
Default event handler for ActiveX control event "DblClick" (DISPID_DBLCLICK).
:mouseDown()
Default event handler for ActiveX control event "MouseDown" (DISPID_MOUSEDOWN).
:mouseUp()
Default event handler for ActiveX control event "MouseUp" (DISPID_MOUSEUP).
:mouseMove()
Default event handler for ActiveX control event "MouseMove" (DISPID_MOUSEMOVE).
Default handlers for system-internal events
:activate()
Trigger the standard action associated with an ActiveX control.
Mouse messages
xbeM_LbClick
Left mouse button clicked.
xbeM_LbDblClick
Left mouse button double clicked.
xbeM_LbDown
Left mouse button pressed.
xbeM_LbUp
Left mouse button released.
xbeM_MbClick
Middle mouse button click.
xbeM_MbDblClick
Middle mouse button double clicked.
xbeM_MbDown
Middle mouse button pressed.
xbeM_MbUp
Middle mouse button released.
xbeM_Motion
Mouse has been moved.
xbeM_RbClick
Right mouse button clicked.
xbeM_RbDblClick
Right mouse button double clicked.
xbeM_RbDown
Right mouse button was pressed.
xbeM_RbUp
Right mouse button released.
Other messages
xbeP_HelpRequest
Help has been requested.
xbeP_Keyboard
Keyboard input received.
xbeP_KillInputFocus
ActiveX control is losing input focus.
xbeP_Move
ActiveX control has been moved.
xbeP_Resize
Size of the ActiveX control has changed.
xbeP_SetInputFocus
Input focus set.
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.