Board index » delphi » Help with ActiveX Property as another Active X

Help with ActiveX Property as another Active X

Hi

I am converting a delphicomponent to Activex.
one of the properties is called "DSource"

This Dsource is of type TxControl...

when I convert the component to active x, Dsource Disappears. I go to Type
library editor and create it with type OleVariant.

I convert the second component (Txcontrol) to Activex.
but the problem is that when i try to write the set and get methods of the
Dsource property it does not accept the conversion between a TxControl and
Olevariant

in short. if i have two delphi component where the first takes the second as
a property
and i convert both to ActiveX's how can i make one activex take another one
as a property.

you know like a Tdatasource takes a TTable as a property

 

Re:Help with ActiveX Property as another Active X


Khodor,

Just create the property with a type of IUnknown and map your control to
that.

So, if you have Dsource of type IUnknown then:

    function TMyControlX.Get_Dsource: IUnknown;
    begin
        Result := IUnknown(TxControl);
    end;

    procedure TMyControlX.Set_Dsource(Value: IUnknown);
    begin
        FxControl := TxControl(Value);
    end;

I haven't yet figured out how to make this show up in the Object Inspector
in either Delphi or VB however. But you can map it in code:

    MyControlX1.Dsource := xControl1;

I believe this should work. I haven't tried this in Delphi yet but if my
memory serves me correct this is the way I did it to get it working.

Hope this helps.

Brian Armstrong.

Quote
khodor bdeir wrote in message <6p1s7m$jb...@forums.borland.com>...
>Hi

>I am converting a delphicomponent to Activex.
>one of the properties is called "DSource"

>This Dsource is of type TxControl...

>when I convert the component to active x, Dsource Disappears. I go to Type
>library editor and create it with type OleVariant.

>I convert the second component (Txcontrol) to Activex.
>but the problem is that when i try to write the set and get methods of the
>Dsource property it does not accept the conversion between a TxControl and
>Olevariant

>in short. if i have two delphi component where the first takes the second
as
>a property
>and i convert both to ActiveX's how can i make one activex take another one
>as a property.

>you know like a Tdatasource takes a TTable as a property

Re:Help with ActiveX Property as another Active X


Hello,

Just a follow-up to my last email, you should cast the type as IDispatch
instead of IUnknown below, and it should work.

You can then access the properties of the ActiveX control by
FxControl.SomeMethod or FxControl.SomeProperty.

Hope this helps.

Brian Armstrong.

Quote
Brian Armstrong wrote in message <6p2eo3$k...@forums.borland.com>...
>Khodor,

>Just create the property with a type of IUnknown and map your control to
>that.

>So, if you have Dsource of type IUnknown then:

>    function TMyControlX.Get_Dsource: IUnknown;
>    begin
>        Result := IUnknown(TxControl);
>    end;

>    procedure TMyControlX.Set_Dsource(Value: IUnknown);
>    begin
>        FxControl := TxControl(Value);
>    end;

>I haven't yet figured out how to make this show up in the Object Inspector
>in either Delphi or VB however. But you can map it in code:

>    MyControlX1.Dsource := xControl1;

>I believe this should work. I haven't tried this in Delphi yet but if my
>memory serves me correct this is the way I did it to get it working.

>Hope this helps.

>Brian Armstrong.

Re:Help with ActiveX Property as another Active X


Hello,

Does the TxControl need to be an "ActiveX" control, or can it just be a
regular automatable object? If so, you can use TAutoIntfObject to wrap
TxControl and expose an IxControl interface that you can use as the data
type for the DSource property.

have fun,

--
Binh Ly
Brickhouse Data Systems, Inc.
http://www.brickhouse.com

Quote
khodor bdeir wrote in message <6p1s7m$jb...@forums.borland.com>...
>Hi

>I am converting a delphicomponent to Activex.
>one of the properties is called "DSource"

>This Dsource is of type TxControl...

>when I convert the component to active x, Dsource Disappears. I go to Type
>library editor and create it with type OleVariant.

>I convert the second component (Txcontrol) to Activex.
>but the problem is that when i try to write the set and get methods of the
>Dsource property it does not accept the conversion between a TxControl and
>Olevariant

>in short. if i have two delphi component where the first takes the second
as
>a property
>and i convert both to ActiveX's how can i make one activex take another one
>as a property.

>you know like a Tdatasource takes a TTable as a property

Other Threads