Solved

My child dialog won't tab inside??

Posted on 1997-04-08
5
734 Views
Last Modified: 2013-12-03
I've created a modal dialog box which contains a tab control and in the tab control display area, I'm displaying a child modeless dialog box (depending apon which tab is selected). When I try to tab from field to field in the modeless dialog box, I simply end up tabbing back to controls on the parent
dialog box. I want to be able to tab from field to field in the child dialog box.

I tried adding the DS_CONTROL style to the child modeless dialog boxes but now when I click on a field in the child, my system hangs and requires cold reboot. If you can help me, I would really appreciate it.

Here's the styles I'm using for the parent dialog box which contains the tab control:
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CAPTION |
    WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP

Here's the styles I'm using (trying to) for the children
STYLE WS_CHILD | DS_CONTROL

All the edit fields in my child dialog boxes have the WS_TABSTOP set and the first edit field in each child has the WS_GROUP also. However, with the DS_CONTROL style the system hangs (as mentioned above).

BTW- When I create the modeless children using CreateDialog, I specify the parent hwnd as the tab control hwnd if that makes any diff. Also, I'm creating all the children at once and then making them visible later when their tab is selected.

Thanks for any help you can offer!
-Rob Morton
0
Comment
Question by:Robert Morton
  • 3
5 Comments
 
LVL 1

Expert Comment

by:dominic01
ID: 1334474
The problem with modeless dialog box is the messages are not passed from the parent to the dialog box.

What you have to do is to test if the message is for a dialog box anf if yes then send it. This can be done by inserting something like this in your message loop:


    while ( GetMessage(&msg, NULL, 0, 0) ) {

      /* Translates virtual key codes */
      
//****** Here is what you are looking for *******************
if(msg.hwnd && IsDialogMessage(msg.hwnd, &msg))  continue;
//***********************************************************
      TranslateMessage(&msg);
      
      /* Dispatches message to window */
      DispatchMessage(&msg);
    }

Let me know if it worked.

DOM



0
 

Author Comment

by:Robert Morton
ID: 1334475
Since my modal dialog box is the parent of all my modeless dialog boxes, ALL messages are coming to its DialogProc and not WndProc. Therefore there's no reason to try to determine whether each message is dialog related since they ALL will be. Since I'm not trying to change the behavior of tabbing from control to control on my modeless dialog boxes or even the parent modal one, I'm not trapping for this message and I'm returning FALSE in my modal parent and modeless children DialogProcs. Therefore, whether the message comes to the parent or the child, Windows still receives a FALSE return value in hopes that Windows will tab correctly.
0
 

Author Comment

by:Robert Morton
ID: 1334476

0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 1334477
dominic01's answer is correct, but he gives the wrong reason.

Windows handles the tabbing and keyboard navigation for your application behind the scenes during the handling of IsDialogMessage().  If you message loop isn't calling IsDialogMessage() for _all_ of the dialogs that are up, keyboard focus navigation is not going to work for all of them.

While you may know that all the messages you're pumping are dialog-related, you need to let windows know, too. The only way to do that is to call IsDialogMessage() so that Windows has a shot at properly handling the messages needed to do keyboard focus navigation.

.B ekiM

0
 

Author Comment

by:Robert Morton
ID: 1334478
Thanks for taking the time to answer my question. I would have deleted it but ex-xchange lacks that feature. My assignment of the tab control hwnd to be the parent for the child modeless dialog boxes was causing the prob. After reassigning all the child modeless dialog boxes to the hwnd of the modal dialog box, my tabbing problem dissapeared.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now