Posted by Marconi on September 30, 2002
In Reply to: How to make Enter key work in the Exe posted by Centu
on September 28, 2002
: Hello!
: I developed a simple program which calculates the average. But in the exe only tab key works. Enter key is not working to switch between the text fields. What attribute need to be set. I am a beginner in Delphi programming.
Set the Form.KeyPreview to True. Set Default to False for every button in the form. Make the event OnKeyPress for the Form like this:
Procedure Tform1.FormKeyPress(Sender: Tobject; var Key: Char);
begin
If key = #13 then
Begin
Key:= #0;
Perform(Wm_NextDlgCtl,0,0);
end;
end;
Related articles:
OnKeypress / TEdit
Disable ALT-F4 key combination
Function keys as shortcuts for buttons
Keypress in console application
Delphi Forum :: Tutorials :: Source code :: Tips
|