For Programmers: Free Programming Magazines  


Home > Archive > Delphi > April 2006 > Communicating between ActiveX Classes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Communicating between ActiveX Classes
chaitanyavrk

2006-04-24, 11:07 pm

The problem is with ActiveX programming, where I need to create a class
and to communicate with other classes.

Actual Requirement:


I have to create a base class "GraphContainer", and some other classes
"AnalogGraph", "BinaryGraph", and etc with some properties like
graph name, graph data and etc.


"GraphContainer" is the actual OCX component and remaining all should
come under it as sub classes.


The user in his application, needs to use some thing this like:


var analogGraph1 : GraphContainer1. AnalogGraph;


analogGraph1.Width := 120;
analogGraph1.Color := [some Ole_Color];


Problem with the current implementation:


I created a Delphi activeForm in which the following exists.


1. Say the main unit file is the "ActiveFormImpl", in which the
following is defined.
type
TDGActiveForm = class(TActiveForm, IDGActiveForm)


2. Now I added a new COM Object called "MainLayer".
2.1. For this class and the corresponding Interface, I added two
properties say "Width" and "Height".


Now, how can I pass these values to the control (say Graph), which is
present in the ActiveForm.


Creating an Instance for the ActiveForm in the MainLayer is working but
its not reflecting in the client application
(since the both instances are not the same).
Is there any method to use the main activeX class like a static class
or any thing like that, to access its methods.


After registering this, I am getting these two classes as two different
controls.


Please propose a solution, thru which I can achieve this.
Is the above way correct or Should I do some thing else.


Many thanks for all the responses.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com