Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

My child dialog won't tab inside??

Posted on 1997-04-08
5
Medium Priority
?
752 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 100 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

664 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