0

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.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by BitFarmer
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.