Hi!
fpc allows this restricted way of recursion between units/forms:
In unit1/Form1:
Interface
uses ..... unit2;
...
And in unit2/Form2:
Interface
.....
Implementation
uses .....,unit1;
So you can access in unit2 the properties of Form1.
Winni
Thanks Winni, but that's not exactly what I think I need. Your code solves a concrete case where you know the name of the unit and the parent form. Actually, what I need is to make Form2's code self-aware of whoever is calling it. We may even have multiple callers from different executables. I intend to share Form2 among a few programs that belong to the same project. And in future projects it will be reused again.
By the way, I guess that in your solution access properties as follows:
procedure TForm2.FormCreate(Sender: TObject);
begin
Form2.Color := Form1.Color;
end;
It actually works, but you need to code the name of the parent form and you may have several parent forms
It will eventually become difficult to mantein and reuse.
By the way, I am not sure about the convinience of accessing foreign properties this manner (Component.Property). I believe it is a violation of one of the OOP principles called "encapsulation" or ocultation (I don't remember right now). It's more common to manipulate properties with "getters" and "setters", at least in other OOP languages, I dont know if this is correct in Object Pascal/Delphi.
I attach a screenshot of your solution tested. Thanks.