[Webinar] Streamline your web hosting managementRegister Today


CTreeView tab key beeping problem

Posted on 1999-11-22
Medium Priority
Last Modified: 2013-11-20
I have a class derived from CTreeView, and I want the user to be able to use the tab key and shift-tab to perform actions.  My class has an OnKeyDown function responding to a TVN_KEYDOWN message.  I have two problems:

1.  When the tab key is pressed, the application executes the code in the OnKeyDown switch statement properly, but then it beeps (apparently the default behavior for an undefined key in CTreeCtrl).  Setting *pResult to TRUE has no effect.

2.  I don't see any way to distinguish between the tab key and the shift-tab key.  They both return the same key codes.

I have tried using a function responding to WM_KEYDOWN instead of TVN_KEYDOWN, but the problems are the same.  Any help is appreciated.
Question by:DougBell
  • 2

Accepted Solution

PIG earned 400 total points
ID: 2225091
I make test with Your problems. If I set *pResult = 1 no default implementation used.
For Your second question. When You down SHIFT You recive notification with wVKey = 0x0010 and later recive wVKey = 0x0009. I think that You can make owner flag for entry with SHIFT key presed.
If You give some more information ... I don't now. I think than ave not a problem.

Expert Comment

ID: 2225098
BTW Chwck All Your exit paths. There can to be a problem with Beep.

Author Comment

ID: 2226619
You were right about the beep stopping when *pResult = 1.  I must have had something else wrong when I tried it.

For the tab key, I'm aware that the shift key returns a code (it's 16, not 10).  The problem is telling when it's down.  I have implemented a flag variable that is set to TRUE by OnKeyDown and to FALSE by OnKeyUp.  It is also set to FALSE by OnKillFocus, in case the key is still down when the view loses focus.  The results still aren't exactly right, though, since shift-tab is read as tab if the shift key is down when the view gains focus.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question