In one form of my application, we add sets of data by adding frames to the form. For each frame, we want to be able to move from one edit (Dev Express Editors) control to the next by pressing the Enter key. So far, I have tried four different methods in my control's KeyPress and KeyUp events.
SelectNext(TcxCurrencyEdit(Sender), True, True); // also base types attempted
SelectNext(Sender as TWinControl, True, True);
Perform(WM_NEXTDLGCTL, 0, 0);
f := TForm(self.Parent); // f is TForm or my form
c := f.FindNextControl(f.ActiveControl, true, true, false); // c is TWinControl or TcxCurrencyEdit
if assigned(c) then c.SetFocus;
None of these methods are working in Delphi 5. Can anyone guide me towards getting this working? Thanks.
This works in Delphi 3, 5 and 6:
Set form's KeyPreview property to True.
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
If (Key = #13) then
Begin
SelectNext(ActiveControl as TWinControl, True, True);
Key := #0;
End;
end;