mfc >> Tab key does not work in CDialogBar

by abhi_junk » Mon, 26 Apr 2004 04:59:58 GMT

I have a dialog bar containing two edit controls and two associated
(buddy) spin controls. I have set the tab order for the controls in
the resource editor (and enabled Tab stop property for edit controls),
and instantiated the dialog bar in CMainFrame::OnCreate().

The dialog bar works fine, except that pressing the tab key does not
move the cursor to the next edit control.

The problem is that I have assigned the Tab key as a shortcut key for
one of the application menus (set via accelerator table). The
framework is routing the Tab key to the application menu, and hence
the CDialogBar never sees this keypress. What should I do to route the
Tab keypress to dialogbar when a control in the dialog bar has focus
and route it to application meu when the dialog bar does NOT have the

Thank you for help

Similar Threads

1. Tab key not working in Visual Studio - CSharp/C#

2. Tab key press does not work when MS flex grid presend on CFormView Based views

When dynamically create a MS Flex Grid based grid control on a CFormView 
based view in MFC application, tab will stop working after one press which 
will put the last columns header of the grid control in focus and you could 
not tab anymore. You have  to move the carrot to another control on the view 
manually using mouse, then the tab will start working again. This only 
happens with the .NET VS 2003 and 2005 compiler. 

3. TAB KEY working together KEY PRESS event??? - CSharp/C#

4. Tab keys and accelerators don't work in mfc regular dll

I am wondering why I can't get tab keys or accelerators to work in a mfc
regular dll my main application is calling.  It doesn't matter if mfc is
statically linked or shared.


5. TAB Key doesn't work in my DLL dialog app

6. intellisense doe not work in 2005


I have a ~300K long C/C++ code that is developed with visual studio.  It is 
"clean C" meaning that it can be compiled as either a C or C++ code.  It 
compiles successfully with gcc (-Wall set), the Portland Group compilers, HP 
cc, and 2003 and 2005 versions of visual studio.

Intellisense stopped working a few weeks ago and nothing has gotten it back. 
The problem is specific to VS 2005, it still works in 2003.  I have deleted 
the ncb file and recompiled, and have even created a new project.  No joy. 
The following are true:


the code is very close to the ansi standard for C and compiles as C++. 
Intellisense in 2005 fails when treated as either C and C++

the code has been compiled with several different compilers, and passes PC 
Lint cleanly.  It is highly unlikely that language errors are present.

intellisense works in VS 2003, but not 2005

if i remove most source files but leave all the header files in the project, 
intellisense 2005.

removing the ncb file and recompiling does not help.


This sounds like a bug in 2005.  I would hate to have to move back to 2003 
to get intellisense back.  Any ideas what to do?


7. Tab key does not move focus correctly on VB ActiveX control

8. Builder 2007 Controls Not Receiving Focus Rectangle When Simulating "tab" key with PostMessage

When simulating the tab key being pressed, the focus rectangle is not
being being displayed on the newly focused control.  This ONLY happens
when a TButton or TBitBtn is added to the form (there may be other
controls) and Runtime Themes are enabled (vista).

Start a new project
Add a TEdit Control to the form
Add a TListBox Control to the form

Add the following code to project (Edit1 KeyPress Event)

void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
	if (Key == '\r')           //Return Key Pressed
		Key = 0;
		PostMessage(Handle, WM_NEXTDLGCTL,0,0);

Run the project.
When you press the enter key (focus should be in the edit box), the
focus moves from the edit control to the listbox as expected and the
listbox receives a focus rectrangle.

Now add a TButton to the form...and re-run the project.
When you press the enter key (focus should be in the edit box), the
listbox DOES NOT receive a focus rectangle.  This issue happens with
combo boxes, checkboxes and many other controls.

If you use the TAB key instead of the enter key, everything works as

Any ideas?