VK_TAB Message NOT getting to correct dialog
Posted on 2006-03-29
I have a MDI project that, based on the user selected item, performs an OnNewDocument() which opens a view. The view then examines a variable in the CDocument class to determine which CDialog to open in a non-modal state. The CDialog opens as a child of the CView, and may or may not have a tab control, so there might be many additional CDialogs that are children.
Some of the CDialogs are simple input and output functions with no need to create a thread. Some,. however, do call AfxBeginThread to a non-interactive thread---a function as opposed to a class is called.
Based on some excellent advice from this forum, I added a message handler after the AfxBeginThread() so that the CView of the calling CDialog could respond to minimize messages, and other CDialogs could continue to process keystrokes while the thread processed.
My problem is that the VK_TAB key is not reaching the CDialog with focus. Whenever I hit the TAB key, the system beeps, and nothing else happens. In the message handler in the CDialog that called the thread, I can see the VK_KEYDOWN message with a param of VK_TAB. Unfortunately, that message never reaches the dialog with focus.
I have read other posts on this forum that suggest that the focus is flying off of the Dialog. If it is it must be going to the CView that is the parent of the dialog, because the CView fails to dim as I would expect with a loss of focus. As the dialogs have no header, I am unable to tell if they have the focus or not.
BTW: the bahavior is identical whether it is Document->View->Dialog or Document->View->Dialog->TabControl->MoreDialogs
Any help will be greatly appreciated.