Let the Edit without continuous Taborder continuous focus [essence]
Sometimes there are many controls on an interface. There is no reasonable Taborder when designing, and each window control is based on the sequence number of Taborder. To this end, we must seriously adjust the serial number of Taborder carefully.
Below this code doesn't matter, when the Edit control gets focus, press the Enter key, the focus will go to the next Edit control:
Procedure TForm1.FormCreate (Sender: TOBJECT); VAR N: INTEGER; begin for n: = 0 to controlcount-1 do if controls [n] is tedit the // Associate all Presented TEDIT's keydown to Key_Retototab Tedit (Controls [ N]). onkeydown: = key_retototab;
Procedure tform1.key_returntotab (Sender: Tobject; Var Key: Word; Shift: tshiftstate); var twc: twinControl; begin // Here you process Enter key change to change button if key = $ D THEN / / Check if it is a carriage return Key code if sender is tedit dam: = twinControl (sender); Repeat TWC: = FindnextControl (TWC, True, True, False); Until twc.classname = 'TEDIT'; Twc.Setfocus; end; end;
The last parameter of the FindNextControl (TWC, True, True, false "function is used to define whether it is limited to a certain parent control range. Most of the cases should be true.