U.C. Luber
U.C. Luber

Reputation: 11

Why is VK_RETURN not passed to Form OnKeyPress event in subordinated form?

I have a TEdit on my main form, and on a secondary form, where I want the Enter key to call a procedure.

In both forms, I used the OnKeyPress event, but it only works in the main form.

In the secondary form, pressing Enter performs a Tab action, and neither form's OnKeyPress nor Edit's OnKeyPress events are called.

I tested in Show() and ShowModal(), the secondary form with or without OnKeyPress.

This was no surprise for me, since in the main form the Edits's OnKeyPress is activated before the form's OnKeyPress.

Is there any option of a TForm that automates the Enter key as a Tab?

Upvotes: 0

Views: 171

Answers (1)

U.C. Luber
U.C. Luber

Reputation: 11

Sorry, I overlooked, that there was an OnDialogKey merged, that performed this action

Upvotes: 1

Related Questions