Вопрос

I have 3 units

-Main
-transfer
-Spell

What i need is for main to be able to access spell and spell to be able to access main.

So what i have tried is

MAIN
uses transfer;

TRANSFER
uses ;

SPELL 
uses main,transfer;

This way main can send data to transfer and spell can get the data from transfer and update main..

Is this a normal way of doing this? How can i do it better? There is alot of data comming from main that spell needs. Also alot of items that are changed in main from spell.

Это было полезно?

Решение

This depends on what is needed of each unit. In certain cases, you can move units to the uses clause at the beginning of your implementation section (as opposed to the beginning of your interface). But that all depends on what is needed.

Whenever you consider moving units to the implementation section, you should always ask yourself why you should have to do so. Usually cross-referencing units can lead to an overload of dependencies, and kinda defeats the purpose of creating self-contained units. For example, if you put code in a separate unit than your main form, there should be no reason that unit should refer back to the main form.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top