Trapping the CTRL-TAB KEY for the CTabCtrl
wallacechoi@hactl.com.hk
Wednesday, November 06, 1996
Environment: VC++4.0, Win95
I am trying to override the Standard Tab control to make it behaves
like Property Sheet. I am now able to add dialog page, and switching
the page when the user click another tab item. Everything seems work
fine except I have problem to trap the "Control - Tab" key to tab
throught the Tab items.
I look for the WM_CHAR, WM_SYSKEYDOWN and WM_KEYDOWN handler but it
van. Finally, I resort to PreTranslateMessage message handler but I
don't know how to detect the "Control - Tab" key.
Any idea?? Thanks in advance.
Wallace, PEI, HACTL
Charlie Jursch -- cjursch@pacbell.net
Thursday, November 07, 1996
At 10:24 AM 11/6/96 +0800, you wrote:
> Environment: VC++4.0, Win95
>
> I am trying to override the Standard Tab control to make it behaves
> like Property Sheet. I am now able to add dialog page, and switching
> the page when the user click another tab item. Everything seems work
> fine except I have problem to trap the "Control - Tab" key to tab
> throught the Tab items.
>
> I look for the WM_CHAR, WM_SYSKEYDOWN and WM_KEYDOWN handler but it
> van. Finally, I resort to PreTranslateMessage message handler but I
> don't know how to detect the "Control - Tab" key.
>
> Any idea?? Thanks in advance.
>
> Wallace, PEI, HACTL
>
>
>
In PreTranslateMessage use the following:
if (pMsg->message == WM_KEYDOWN)
{
switch (pMsg->wParam)
{
case VK_TAB:
if (::GetKeyState (VK_CONTROL) < 0)
{
do your stuff here
}
}
}
[Moderator's note: I'm not sure I would trust GetKeyState in
this case. It is possible for the control key to change state
between when the message is sent and when it is handled. Does
anyone know if it is possible to get this same info from
the message? If not, at least you can have PreTranslateMessage
also track the control key messages.]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Charlie Jursch "Be kind to your web-footed
Patotech Software, Inc. friends for a duck may be
1-800-PATOTECH somebody's mother."
mailto: cjursch@pacbell.net
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin J. Mahoney -- mjm@PyramidLogicSystems.com
Friday, November 08, 1996
> [Moderator's note: I'm not sure I would trust GetKeyState in
> this case. It is possible for the control key to change state
> between when the message is sent and when it is handled. Does
> anyone know if it is possible to get this same info from
> the message? If not, at least you can have PreTranslateMessage
> also track the control key messages.]
>
According to Microsoft's documentation, GetKeyState returns the state of
the virtual at the time the message was generated and GetAsyncKeyState at
the time the message is handled.
Look in VC++ book online at Under
SDKs
Win32 Programmer's Reference
Overviews
Window Management
Keyboard Input
About Keyboard Input
Key Status.
Martin J. Mahoney
http://www.PyramidLogicSystems.com
| Вернуться в корень Архива
|