how can i make my code to work ? :) i`ve tried to formulate this question but after several failed attempts i think you guys will spot the problem faster looking at the code
There is no need to cast to TMemo and TEdit separately, as they are both descendants from common parent class, which have ReadOnly property:
procedure TForm1.FormCreate(Sender: TObject);
procedure P(const Obj: TComponent);
begin
if Obj is TCustomEdit then
TCustomEdit(Obj).ReadOnly := True;
end;
begin
P(Memo1);
P(Edit1);
end;