Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing an OCX
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00319745
Message ID:
00321037
Views:
23
>>>Does that mean if you have this sub-classed ActiveX control in a VCX library, that you can now use it in code, too? How would you use it in a DEFINE CLASS myform AS FORM, for example. I've had trouble trying to do this from a .PRG.
>>>
>>>TIA
>>


I am using DBI-Techs Control Pak extensively. 54 ocx's

Here is what I have done.

Created a VCX named: basectrldbi40.vcx
I added all 54 controls to this vcx.
Very little code goes here, I'll explain a later.
This VCX is where the License file gets stored when you add the control to it.

Created a second VCX named: basectrldbi

I started out adding a container to this vcx named: ccntbase

For every control in the pak I added a container to this vcx subclassed from ccntbase. I used a
naming convention that associated each container with a control in the basectrldbi40.vcx. One to One
relationship. I.e. cdbimg - Image Control. cdblst List Control.

In the class ccntbase I created a couple of properties:
cActiveXCtlLib - Name of Library containing Active X Control.
cActiveXCtlName - Name of Active X Control to add to this container.

In the init method of ccntbase I placed the following code.

WITH THIS
SET CLASSLIB TO (.cActiveXCtlLib) ADDITIVE

.ADDOBJECT('oActiveXCtl', .cActiveXCtlName)

RELEASE CLASSLIB (.cActiveXCtlLib)
ENDWITH

I drop the container class that is associated to a particular control on my forms from basectrldbi not the
activex control. This takes care of versioning problems with the actual x controls that are actually installed
and active x control licenses getting added all over the place. This is a real short statement for all that goes on here
underneath.

In each container class for an activex control I have a property and a method for every property and method
that is in the associated activex control. Using the assign methods for properties in the container
I cause a property to pass through the value assignment onto the actual activex control at runtime.

A method in a container through to the active x control at runtime.

The only code I place in the Active X Control in basectrldbi40 is call backs to the containers for events

I.E. in the click event of a the actual list box active x control I place THIS.PARENT.Click()


My forms talk to the containers, the containers talk to the activex control. As far as events are
concerned the active X control talks to my container my container talks to the world outside of itself.

There is a whole lot more that I could say but these are the basics. I have been working with this for
6 months and am very happy.
What ben makes tracks for what wil be. Words in the air pirnt foot steps on the groun for us to put our feet in to.

Riddley Walker
Previous
Reply
Map
View

Click here to load this message in the networking platform