Using Enter instead of Tab in edit controls.
Posted on 1999-01-22
I have just started using D4 - a leap from D1. I want to make edit controls respond to the Enter key instead of Tab to move between controls on a form. In D1 I used the following code:
procedure TEnterEdit.KeyPress(var Key: Char);
if Key = #13 then
MYForm := GetParentForm( Self );
if not (MYForm = nil ) then
SendMessage(MYForm.Handle, WM_NEXTDLGCTL, 0, 0);
Key := #0;
if Key <> #0 then inherited KeyPress(Key);
When I tried to compile the component under D4 I got an error telling me that I couldn't use the MyForm variable because of a difference with TCustomForm.
What do I need to change to get the component to work under D4?