Dialog box in a dialog box 
Author Message
 Dialog box in a dialog box

Hi,

I want to hide/show a group of controls in a dialog box. For this I
thought it would be nice to have several dialog child boxes and than I
could hide or show that dialog easily.

How can I create and show a dialog box in another dialog box ?

Thanks in advance,

Devrim.



Sat, 28 Aug 2004 05:46:30 GMT  
 Dialog box in a dialog box
You might find this article interesting.  It's not exactly what you're
asking, but it might help you do what you're trying to do.

http://www.codeguru.com/controls/enable_control_grp.shtml

This article is also interesting.

Tom


Quote:
> Hi,

> I want to hide/show a group of controls in a dialog box. For this I
> thought it would be nice to have several dialog child boxes and than I
> could hide or show that dialog easily.

> How can I create and show a dialog box in another dialog box ?

> Thanks in advance,

> Devrim.



Sat, 28 Aug 2004 06:27:57 GMT  
 Dialog box in a dialog box
Oops.  sticky fingers...

http://www.codeguru.com/dialog/StackDialog.shtml

Tom


Quote:
> Hi,

> I want to hide/show a group of controls in a dialog box. For this I
> thought it would be nice to have several dialog child boxes and than I
> could hide or show that dialog easily.

> How can I create and show a dialog box in another dialog box ?

> Thanks in advance,

> Devrim.



Sat, 28 Aug 2004 06:28:49 GMT  
 Dialog box in a dialog box
There are a couple approaches. The easiest one is to simply have a function
void CMyDialog::ShowControls(BOOL mode)
   {
    UINT show = mode ? SW_SHOW : SW_HIDE;
    c_StartButton.ShowWindow(show);
    c_Result.ShowWindow(show);
    c_Notification.ShowWIndow(show);
    ... etc.
   }

where the c_ variables are control member variables representing the windows (see my essay
on Avoiding GetDlgItem on my MVP Tips site).

Another approach is to group the controls either within a group box or a static frame (the
static frame could be invisible), and then do

void CMyDialog::ShowControls(BOOL mode, CWnd * enclosing)
   {
    CRect r;
    enclosing->GetWindowRect(&r);
    ScreenToClient(&r);

    for(CWnd * wnd = GetWindow(GW_CHILD); wnd != NULL; wnd = wnd->GetWindow(GW_HWNDNEXT))
     {
      CRect c;
      UINT show = mode ? SW_SHOW : SW_HIDE;
      wnd->GetWindowRect(&c);
      ScreenToClient(&c);
      CPoint pt(c.left, c.top);
      if(r.PtInRect(c))
         {
          wnd->ShowWindow(show);
         }
   }

You can now disable a group of controls by passing in the window reference for the
enclosing window, e.g.,
        ShowControls(FALSE, &c_Caption);
will disable all controls whose top left corner is contained entirely within the window
referenced by c_Caption.

Note that if the focus was on any control that has just been hidden, you should move it
(there was an earlier post on this topic, a trick I had forgotten)
                        joe

Quote:

>Hi,

>I want to hide/show a group of controls in a dialog box. For this I
>thought it would be nice to have several dialog child boxes and than I
>could hide or show that dialog easily.

>How can I create and show a dialog box in another dialog box ?

>Thanks in advance,

>Devrim.

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Mon, 30 Aug 2004 10:06:53 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. activating a button on a dialog box from a dialog box

2. transfer data from one dialog box to another dialog box

3. Modeless dialog box together with modal dialog box

4. PBM: Message box not displayed after main dialog box is closed in MFC dialog-based app

5. set an arbitrary printer driver in print dialog box without showing the print dialog box

6. how to set an arbitrary printer driver in print dialog box without showing the dialog box

7. Transfer of data from an edit box in one dialog box to a list box in another dialog box II

8. ? Dialog box input and output edit boxes

9. i cannot add an item to my list box that is located within my dialog box

10. List boxes in Modal Dialog Box

11. Associating an array of strings to several Edit Boxes in a Dialog Box

12. edit boxes and dialog boxes

 

 
Powered by phpBB® Forum Software