Главная страница | назад





Article #16096: Translate RETURN key to TAB key

 Question and Answer Database
FAQ1096C.txt Translate RETURN key to TAB key
Category :Windows API
Platform :All
Product :BC++ 5.x
Question:
I have a TDialog with various TEdits on it. For reasons of
compatiblity with a legacy system, I would like to translate
the event generated when the user hits the RETURN key
into an event that looks like he hit the TAB key. How can
this be done?
Answer:
There are actually several methods for doing this. You can
override the PreProcessMsg for a dialog and check
for the VK_RETURN key. When it is found, setfocus to the
next available dialog control (check your API calls for this).
You can do more triggering with this as well by checking to
see which handle (child window) actually has control by doing
a case statement and then do other specialy processing.
You can tab by posting the WM_NEXTDLGCTL message to the
HWindow of the dialog box, with wParam set to zero and LOWORD
(lParam) set to zero as well.
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99