This:
with StringGrid1 do
if ( aRow > 0 ) then
begin
Edit1.BoundsRect := CellRect(aCol,aRow);
Edit1.Text := Cells[aCol,aRow];
Editor := Edit1; // -- Editor is not the parameter here, but Grid's property!
end;
does not work, because Grid has the property of same name - Editor. So, when you enclose the code in "with" block, the property name takes precedence over the method's var parameter.
Compiler understands last line as if it is "StringGrid1.Editor := Edit1;".
This works:
if ( aRow > 0 ) then begin
with StringGrid1 do begin
Edit1.BoundsRect := CellRect(aCol,aRow);
Edit1.Text := Cells[aCol,aRow];
end;
Editor := Edit1;
end;
This is a nice illustration of the dangerous side effects of using "with" in object pascal. Never enclose in "with" block more than actually needed!
Use "with" with care, avoid it as much as possible.