Assignments among OLEControl, OLECustomControl, and OLEObject datatypes – PB Docs 125

Assignments among OLEControl, OLECustomControl, and OLEObject datatypes

You cannot assign an OLE control (object type OLEControl)
or ActiveX control (object type OLECustomControl) to an OLEObject.

If the vendor of the control exposes a programmatic identifier
(in the form vendor.application), you can specify
this identifier in the ConnectToNewObject function
to connect to the programmable interface without the visual control. For
an ActiveX control with events, this technique makes the events unavailable.
ActiveX controls are not meant to be used this way and would not be
useful in most cases.

You can assign the Object property of an OLE control to an
OLEObject variable or use it as an OLEObject in a function.

For example, if you have an OLEControl ole_1 and
an OLECustomControl ole_2 in a window
and you have declared this variable:

then you can make these assignments:

You cannot assign an OLEObject to the Object property of an
OLE control because it is read-only. You cannot make this assignment:

Events for OLEObjects

You can implement events for an OLEObject by creating a user
object that is a descendant of OLEObject. The SetAutomationPointer PowerScript
function assigns an OLE automation pointer to the descendant so
that it can use OLE automation.

Suppose oleobjectchild is a descendant
of OLEObject that implements events such as the ExternalException
and Error events. The following code creates an OLEObject and an
instance of oleobjectchild, which is a user
object that is a descendant of OLEObject, connects to Excel, then
assigns the automation pointer to the oleobjectchild:

You can now use olechild for automation.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x