Board index » cppbuilder » Getting an object contained in a VCL control to an ActiveX control

Getting an object contained in a VCL control to an ActiveX control

Hello,

I am currently using BCB 5 Pro.

I have created a VCL control, TCompressor, which is derived from TCustomComponent.

This control has two instances of a custom class (TPort) called port.  
The ports have several properties:
        AnsiString PortName
        double P
        double h
        long Destination
        bool Connected
        ...

The VCL Compressor can access the ports via properties.
Ex:
        TCompressor *Compressor

        Compressor->Port[1]->Connected = true

When I create CompressorX, an ActiveX control derived from TCompressor, the port property is not carried along...

I am trying to struggle through the Type Library editor to add a port property to the ActiveX control, but I do not see
how this is done.

Is it possible to create a new type which can be used in the ActiveX control similar to the way I use it in the VCL?

Any support and/or a pointer in the right direction (literature wise) would be greatly appreciated.

Thanks,

Dave!

--
Dave Richardson
d...@glue.umd.edu

 

Re:Getting an object contained in a VCL control to an ActiveX control


Quote
Dave Richardson wrote in message <3ABA658B.277C3...@glue.umd.edu>...
>When I create CompressorX, an ActiveX control derived from TCompressor, the

port property is not carried along...

Dave,
Bring the properties of the port(s) to the surface of the ActiveX.  For
example, you have Port[i]->Connected in the VCL.  In the ActiveX, you'd have
something like

MyX->SetPortConnected(int PortNum, VARIANT_BOOL PortConnected)

and this function, which as part of the ActiveX has access to aggregated
objects, would do the FPort[PortNum]->Connected = (bool)PortConnected.  I
think that would work.  Note I didn't use Port, but FPort, the protected
data member.

Hope this helps,
Dave

Re:Getting an object contained in a VCL control to an ActiveX control


Dave,

Thanks for the advice.

I did do this, and it works well.  I even set the methods up as properties, and it is seamless.

However,

When I originally developed this application in visual basic, I had these "Ports" as ActiveX dll objects.
I would then insert them into other ActiveX objects (Such as a compressor).

When I would access them, I would Access them as Port Objects, via Compressor.Port

I would like to do this again.

Do you think (or know) if it would be possible to create ActiveX controls in BCB that are ports (Call them PortX).

Then insert an array of these PortX into my Compressor Control and map them to the Compressor VCL component.

Would I be able to pass these PortX objects (type IUnknown??) to a parent application and back?

Thanks for advice,

If this is out of your scope, ignore it.

Thanks,

Dave!

Quote
Dave Curry wrote:

> Dave Richardson wrote in message <3ABA658B.277C3...@glue.umd.edu>...
> >When I create CompressorX, an ActiveX control derived from TCompressor, the
> port property is not carried along...

> Dave,
> Bring the properties of the port(s) to the surface of the ActiveX.  For
> example, you have Port[i]->Connected in the VCL.  In the ActiveX, you'd have
> something like

> MyX->SetPortConnected(int PortNum, VARIANT_BOOL PortConnected)

> and this function, which as part of the ActiveX has access to aggregated
> objects, would do the FPort[PortNum]->Connected = (bool)PortConnected.  I
> think that would work.  Note I didn't use Port, but FPort, the protected
> data member.

> Hope this helps,
> Dave

--
Dave Richardson
University of Maryland
Department of Mechanical Engineering
Center for Environmental Energy Engineering
(301) 405-8726
d...@glue.umd.edu

Other Threads