From: AliR (VC++ MVP) on
The reason for OnOK was because the OP was trying to find out how it could
be done without catching WM_KEYDOWN.

AliR.

"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
news:dulj24dm1cfc6nuj8isagglgtt8i2b4bac(a)4ax.com...
> The only problem with this code is that it disables the OK key, and will
> only work under
> circumstances where the <enter> key sends IDOK, which is not true of being
> in all
> controls.
>
> I'd suggest this is one of the few valid uses of PreTranslateMessage.
> joe
>
> On Tue, 13 May 2008 11:10:55 -0500, "AliR \(VC++ MVP\)"
> <AliR(a)online.nospam> wrote:
>
>>Look for
>>
>>void CMyDialog::OnOK()
>>{
>> CWnd *pWnd = GetNextDlgTabItem(GetFocus());
>> if (pWnd)
>> {
>> pWnd->SetFocus();
>> }
>>}
>>
>>AliR.
>>
>>
>>
>>
>>"Landon" <Landon(a)discussions.microsoft.com> wrote in message
>>news:C701AC43-5F70-4847-ABC4-55D99F63A69C(a)microsoft.com...
>>> I've ever seen an application that moves the active control using Tab or
>>> Enter key.
>>>
>>> So the application has a few Combo Boxes, CEdit, Checkboxes and to move
>>> from
>>> one control to another, we can use either Tab or Enter key.
>>>
>>> How to do that?
>>>
>>> I've tried to find it but I still haven't found any.
>>>
>>> Thank you very much.
>>
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm


From: Joseph M. Newcomer on
(1) it means the OK button will never work, a consequence the OP probably didn't think of
(2) to avoid using WM_KEYDOWN, this is the sort of mechanism that PreTranslateMessage was
designed for. In effect, PreTranslateMessage is what is being used by the dialog class to
detect the tab key (yes, I know it is more complex than that, but that's a good
approximation)
joe

On Tue, 13 May 2008 14:49:12 -0500, "AliR \(VC++ MVP\)" <AliR(a)online.nospam> wrote:

>The reason for OnOK was because the OP was trying to find out how it could
>be done without catching WM_KEYDOWN.
>
>AliR.
>
>"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
>news:dulj24dm1cfc6nuj8isagglgtt8i2b4bac(a)4ax.com...
>> The only problem with this code is that it disables the OK key, and will
>> only work under
>> circumstances where the <enter> key sends IDOK, which is not true of being
>> in all
>> controls.
>>
>> I'd suggest this is one of the few valid uses of PreTranslateMessage.
>> joe
>>
>> On Tue, 13 May 2008 11:10:55 -0500, "AliR \(VC++ MVP\)"
>> <AliR(a)online.nospam> wrote:
>>
>>>Look for
>>>
>>>void CMyDialog::OnOK()
>>>{
>>> CWnd *pWnd = GetNextDlgTabItem(GetFocus());
>>> if (pWnd)
>>> {
>>> pWnd->SetFocus();
>>> }
>>>}
>>>
>>>AliR.
>>>
>>>
>>>
>>>
>>>"Landon" <Landon(a)discussions.microsoft.com> wrote in message
>>>news:C701AC43-5F70-4847-ABC4-55D99F63A69C(a)microsoft.com...
>>>> I've ever seen an application that moves the active control using Tab or
>>>> Enter key.
>>>>
>>>> So the application has a few Combo Boxes, CEdit, Checkboxes and to move
>>>> from
>>>> one control to another, we can use either Tab or Enter key.
>>>>
>>>> How to do that?
>>>>
>>>> I've tried to find it but I still haven't found any.
>>>>
>>>> Thank you very much.
>>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer(a)flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Landon on
> (1) it means the OK button will never work, a consequence the OP probably
didn't think of
> (2) to avoid using WM_KEYDOWN, this is the sort of mechanism that PreTranslateMessage was
> designed for. In effect, PreTranslateMessage is what is being used by the dialog class to
> detect the tab key (yes, I know it is more complex than that, but that's a good
> approximation)
> joe

I have already understand if I have to solve it via coding, but what I found
is it was done without any coding, I have tried to look for the keywords
PreTranslateMessage, WM_KEYDOWN, Enter, Return but I could not find any of
those words.

Any idea how the developer did this?

Maybe there is built-in property that must be set?

Thank you very much.
From: Joseph M. Newcomer on
Looked for the keywords where?

On google, I got 36K+ hits for PreTranslateMessage.
In MSDN, typing it into the Index search gets 5 hits, typing it into the Search window
gets me 31 hits.

WM_KEYDOWN gives hits for both the message and the OnKeyDown message.

You can't say "I have tried to look for the keywords" unless you say, specifically, WHERE
you tried to look for them, and it is clear that the two most important places, the MSDN
and google, were not consulted.

How "the" developer did this? Did what, and "the" developer is more likely several
hundred thousand developers.

There is no concept of "built-in property", although you can certainly add a handler for
the virtual method PreTranslateMessage or the window message WM_KEYDOWN.
joe

On Tue, 13 May 2008 17:28:00 -0700, Landon <Landon(a)discussions.microsoft.com> wrote:

>> (1) it means the OK button will never work, a consequence the OP probably
>didn't think of
>> (2) to avoid using WM_KEYDOWN, this is the sort of mechanism that PreTranslateMessage was
>> designed for. In effect, PreTranslateMessage is what is being used by the dialog class to
>> detect the tab key (yes, I know it is more complex than that, but that's a good
>> approximation)
>> joe
>
>I have already understand if I have to solve it via coding, but what I found
>is it was done without any coding, I have tried to look for the keywords
>PreTranslateMessage, WM_KEYDOWN, Enter, Return but I could not find any of
>those words.
>
>Any idea how the developer did this?
>
>Maybe there is built-in property that must be set?
>
>Thank you very much.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Landon on
> Looked for the keywords where?
>
> On google, I got 36K+ hits for PreTranslateMessage.
> In MSDN, typing it into the Index search gets 5 hits, typing it into the Search window
> gets me 31 hits.
>
> WM_KEYDOWN gives hits for both the message and the OnKeyDown message.
>
> You can't say "I have tried to look for the keywords" unless you say, specifically, WHERE
> you tried to look for them, and it is clear that the two most important places, the MSDN
> and google, were not consulted.
>
> How "the" developer did this? Did what, and "the" developer is more likely several
> hundred thousand developers.
>
> There is no concept of "built-in property", although you can certainly add a handler for
> the virtual method PreTranslateMessage or the window message WM_KEYDOWN.
> joe

No, what I mean was:

I have looked for those keywords ( Return, PreTranslateMessage, Enter,
WM_KEYDOWN ) in the MFC SOURCE FILES( *.cpp, *.h, *.rc ) of the application
which has been able to make Enter key behave like Tab key NOT on Google or
other search engine on the WEB.
It really really does not make any sense if I don't found any of those
keywords on the web.

What I just don't understand is what has that APPLICATION
developer/programmer done to make the Enter key works similar as the Tab key
without any of Return, PreTranslateMessage, Enter, WM_KEYDOWN keywords in his
SOURCE FILES?

Got any idea how to do this?

I am sorry to make you confused with my words on the previous post.

Thank you very much.