Created
November 21, 2011 10:33
-
-
Save martinusso/1382264 to your computer and use it in GitHub Desktop.
Make the Enter key work like Tab in Delphi applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
In the Main Form of application | |
} | |
procedure TMainUI.DoEnterAsTab(var Msg: TMsg; var Handled: Boolean); | |
begin | |
if Msg.Message = WM_KEYDOWN then | |
begin | |
if (not (Screen.ActiveControl is TCustomMemo)) and (not (Screen.ActiveControl is TButtonControl)) then | |
begin | |
if Msg.wParam = VK_RETURN then | |
Screen.ActiveForm.Perform(WM_NextDlgCtl, 0, 0); | |
end; | |
end; | |
end; | |
procedure TMainUI.FormCreate(Sender: TObject); | |
begin | |
// At the end of the method, add: | |
Application.OnMessage := DoEnterAsTab; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 12 was changed from:
to: