Link to home
Start Free TrialLog in
Avatar of chachote
chachote

asked on

Use ENTER instead of TAB

what can I do to use ENTER instead of the TAB key to switch from one component to another (for instance Edits).
My Users prefer it that way.
Avatar of inthe
inthe

hi,
on your tedits or whatever OnKeyPress event do

 If key=chr(13) then
SendMessage(handle,WM_NEXTDLGCTL,0,0);


Regards Barry
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This will make the for act exactly as if a tab were pressed:

{Add this to KEYdown event handler for all controls you wish to use enter key}

if (key=13) then postmessage(handle,WM_KeyDown,VK_TAB,0);


Good luck!!
Avatar of chachote

ASKER

Barry

This is good but your next was the best
All answers work, But Barry's is the
best!
Now I improved it by writing it on the Form's OnKeyPress Event, then choose that event for the OnKeyPress event of the controls I want.