I have this code:
edit5.Text := IntToStr(j);
rw := j;
myRect.Left := 0;
myRect.Top := rw;
myRect.Right := 5;
myRect.Bottom := rw;
stringGrid1.Selection := myRect;
edit1.SetFocus;
I must rewrite this code because I'm using it for many events (event button1click
, button2click
, everytime I validate)
so I'm meaning to make then into procedure so I can call it in many event
this code so far I made:
procedure highlight(edit1, edit5: TEdit; myrect: TGridRect;
stringgrid1: TStringgrid; var j, rw: Integer);
begin
edit5.Text := IntToStr(j);
rw := j;
myRect.Left := 0;
myRect.Top := rw;
myRect.Right := 5;
myRect.Bottom := rw;
stringGrid1.Selection := myRect;
edit1.SetFocus;
end;
but I can't call it:
procedure Tform1.Button2Click(Sender: TObject);
begin
highlight;
end;
how to resolve it ? did I must split it ?