an example, I need to do this to solve a problem in a framework I am developing :
//Unit2 :
procedure A(aForm : TForm; AClassType: TFormClass);
begin
ShowMessage (AClassType(aForm).edtUser.text);
end;
...
//Unit1 :
Uses Unit2;
begin
form1 := TForm1.Create;
Try
A(form1, TForm1);
Finally
form1.Free;
End;
end;
The compiler does not accept this line:
AClassType (aform).edtUser.text
One solution would be to use:
Uses
UnitofTForm1;
The procedure (aform: TForm; AClassType: TForm1);
begin
ShowMessage (AClassType (aform).edtUser.text);
end;
But I can not do so because they are giving circular reference and I need some decoupling in my framework
Is there any way to make typecast passing as parameter the type of form or is there another way to do this ?
TFormxxxclasses? Are they all derived from the same base class?