I love when users use the enter as tab, so I usualy use edit's OnKeyPress :
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: char);
begin
if key=#13 then begin
key:=#0;
selectnext(activecontrol, true, true);
end;
end;
But, now I created a form that contains more than 60 edits, grouped in 7-8 groupboxes and there are few non-grouped (just simply placed straight on the form). I dont want to create separate procedures for each of the edits. I tried with a procedure on form's key press, but it doesn't do anything at all :
procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
begin
if key=#13 then begin
key:=#0;
selectnext(activecontrol, true, true);
end;
end;
My question is how to make one procedure (on which event) to detect that the user pressed the Enter/Return key and move the cursor to the next available control ? Reading documentation I've met something like this "(sender as tedit).text", is there possibly a way to trick the form in order to make one procedure and use it form-wide ?