Simulate tab on enter or directional keys

I had miss clic while creating the topic, so I rewrite my question :


I don't find any way to simulate a tab when enter or directional key is pressed. Any ideas to do that ?

I assume you want to move the focus to the next control in tab order?
If so, you need to do something like:

document.activeElement.nextElementByTabIndex.focus();

Thank you Bruno for your answer.


Yes, it's precisely what I want to do. Sadly, your code isn't working, nextElementByTabIndex is not found.

I precise that I want to do this in Delphi, if possible. Otherwise, can you explain me how to implement that in Javascript from Delphi ?

For  your convenience, we have implemented Form.SelectFirst, Form.SelectNext, identical to the VCL to do this. This extension will be available in the next update.

Really cool, big thank you !

Can i have a sample how use Form.SelectNext in KeyPress event for example ?

We do not have a ready-made sample for this particular use.
What is not clear about this that you need a sample?

Add 2 edit controls on the form, add OnKeyPress and the code:

procedure TForm3.WebEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if key ='a' then
    self.SelectNext(WebEdit1, true, false);
end;

and when you press 'a' in the edit it will move focus to the next edit.