how to comunicate among these objects lazarus / 21-General ---------------------------------------------------------------------- Paolo · 2026-01-10 13:53 Hello I have this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TypeTA = class(TObject)….End; and a lot of children Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TA1 = class(TA)TA2 = class(TA)…TAi=class(TA).. Then I have also another class TB that manages the above TAi. Let say, as an example, I have something like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TypeTB = class(TObject)   X : array of TA;  ..End;  All went fine, unless… I have the need that one of TAi, let say TAn, needs to access a field of TB !!! I solved the problem in a very contrived way, any suggestions from the experts ? Regards ---------------------------------------------------------------------- cdbc · 2026-01-10 14:32 Hi Introduce the "Owner Mechanism":Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  { forward decl. }  TB = class;  { the 'owned' class }  TA = class(TObject)  private    fOwner: TB;  public    { in the constructor we assign 'anOwner' to 'fOwner' }    constructor Create(anOwner: TB);  ...  end;  { actual TB class }  TB = class(TObject)    X: array of TA;  ...  end; ////////////var   Bobj: TB;...  Bobj:= TB.Create;  SetLength(Bobj.X,5);  Bobj.X[0]:= TA.Create(Bobj); /// create with owner...  /// later one can do:  Bobj.X[0].fOwner.DoSomething(); A full fledged example of this can be seen in "TCollection" & "TCollectionItem" Take a good hard long look at the source of TCollection...  Regards Benny ---------------------------------------------------------------------- Thaddy · 2026-01-10 15:15 Alternatively derive from one of the generic object lists and define the root of your class from TComponent, which is where the owner property is introduced. ---------------------------------------------------------------------- Paolo · 2026-01-11 17:06 thank you very much. At the end my code is very close to what you suggest. Essentially I introduce a "father" of TB exposing only the thing that TAn needs, something like Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TBFather = class(TObject)  function DoSomething : integer;end; TA = class(TObject)  //blah, blah..End; { TAn } TAn = class(TA)  Ref : TBFather;  Constructor CreateWithRef(ARef : TBFather);  function DoSomething : integer;  // other fields hereend; TB = class(TBFather)  AB : TAn;  // other fields hereend; implementation  constructor TAn.CreateWithRef(ARef: TBFather);begin  inherited Create;  Ref:=ARef;end; function TAn.DoSomething: integer;begin  result:=Ref.DoSomething;end; ---------------------------------------------------------------------- jamie · 2026-01-11 23:13 Hmm, that kind of looks convoluted Not really sure what you are after however, if you base them from the TPersistent class, you could employ the notifiers that live there and those classes can notify each other when changes are taking place.  Those would be the Observer and Observed items I am talking about. Jamie