Link to home
Start Free TrialLog in
Avatar of urivera
urivera

asked on

Working with Child Dialog boxes

I have a few questions, that is why I'm making this question worth 350 points.

I am writing a FormView application (with Doc/View support) on the Form(lets call this the parent) I have buttons that when clicked launch a modeless dialog box (lets call this the child dialog box), in that box I have radio buttons and check boxes.

1)  I need to know how to default a radio button and check box in the child dialog boxes to be selected when the parent dialog (Form) is launched.  For example, user starts the application, then clicks on button1 that displays child dialog box with certain default settings.

2) How do I program it so that if the user launches a child dialog box, changes the state of the radio buttons or check boxes clicks OK, returns the the parent Form, then launches the same child dialog box and it displays the last settings the user selected NOT the default settings.

3) How do I get the information of the settings of the radio butttons and check boxes from each child dialog box back to the parent form, so I can display the current settings on some static string or edit string.  Is there an efficient and elegant way of doing it in MFC?


I tried using the OnInitDialog function on the parent form to set the default settings for the child dialogs but that did not work.  If i do it from the OnInitDialog function of the child dialog would that not keep that last setting done by the user, wouldn't it revert back to the default setting everytime the user launched the child dialog?  

I want to avoid using the GetDlgItem() function, I want to avoid using it as much as possible in MFC.
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of urivera
urivera

ASKER

Andy I don't quite understand your solution.

Alex, does the child Dlg have access to a pointer to the parent Dlg? Or how does the pointer get passed.

void CParentForm::OnShowDialog()
{
    // Show dialog here
    // Set it's m_pChoice member:
    pDlg->m_pChoice = &m_Choice;
    pDlg->Create(...);
   
}
What don't you understand?  The only obvious thing further I can say is that m_pDlg is a pointer to the modeless dialog you have just created.