Hello All
I am Writing some components that are depend together. for example tow of them named as "TFyzLine" and "TFyzTranse" thay have a same Property that named as "InputFrom" .
"TfyzLine" mast connect to "TFyzTranse" via "InputFrom" and get some data automatically from "TFyzTranse" and "TFyzTranse" mast Connect to "TFyzLine" via "InputFrom" and get data from "TFyzLine" too .
I can Write "TFyzLine" that can connect to "TFyzTranse" via "InputFrom" property and get data from "TFyzTranse". But I can not do same for "TFyzTranse" because of circular declaration.
how cane I Solve this problem.
source codes are attached to this thred.
Thanks.

Easy: One of them uses the other in the interface (on top of the code), while in the other one, after the "implementation" clause, you add a new "uses" -if it is not there by now- and add the unit you need.

In that second unit, the classes defined in the 1st are not availabe on the interface part, because the uses is lower than this, so you can not define a function, for instance, as having a parameter of some of the clases defined in unit 2, so chosing witch one will have the other unit uses in the top is a matter of witch one uses the oither one classes in the interface.

Both unit CAN NOT use the other one clasess on the interface, this is not fixable as long as i know, but i never have had the need of it, and if you need it, then pass a TComponet and, in the implementation, cast it to the proper type and you get the same working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.