Hi all.
 
I have a component and within the same components unit I have a class also.
 
The component creates the class in the create event of the component, and the class references the componet.
 
I.e.
 
    fMyClass : = TMyClass.create(self);
 
In the create event of the class I have
 
constructor TMyClass.Create(AOwner : TMyComponent);
begin
  inherited create;
 
  fOwner :=AOwner;
  showmessage(inttostr(fOwner.componentindex));
end;
 
(fOwner is declared as of type TMyComponent in the private section BTW)
 
Now the showmessage returns the components index fine, BUT, If I call another procedure that has
"showmessage(inttostr(fOwner.componentindex));" in it, I get an access violation !
 
It is surely something I am doing wrong, but I cant understand what.
Can someone give me a hint as to what MIGHT be happening or a hint to what I have forgotten to do ?
 
Cheers, Jeremy Coulter

 

Reply via email to