Solved

Child Dialogs

Posted on 1999-01-29
7
273 Views
Last Modified: 2013-11-20
I've created a Dialog with two nested dialogs. ie a dialog with a child dialog which also has a child dialog, like a
CPropertyPage and CPropertySheet, but with another dialog in the CPropertySheet. (See diagram)

=========================================
=                                                                              =
= DIALOG 1                                                              =
=                   +++++++++++++++++++++++++++++ =
=                   + DIALOG 2                                      + =
=                   +                                   ------------------ + =
=                   +                                   - DIALOG 3- + =
=                   +                                   -                - + =
=                   +                                   -                - + =
=                   +                                   -                - + =
=                   +                                   -                - + =
=                   +                                   ------------------ + =
=                   +                                                      + =
=                   +++++++++++++++++++++++++++++ =
=                                                                              =
=========================================

My question is, is it possible to handle messages from controls on the child dialogs in the main dialog, rather than
creating a separate class for each dialog then sending a custom message to the main dialog?

Thanks

Gavin
0
Comment
Question by:gav061697
7 Comments
 

Author Comment

by:gav061697
ID: 1328514
Edited text of question
0
 

Author Comment

by:gav061697
ID: 1328515
Edited text of question
0
 
LVL 1

Expert Comment

by:arunprakash
ID: 1328516
Get the Message in the pretranslatemessage of the child dialog and call the
pretranslate message of the main dialog and handle it there.
this will do,
thanx,
bye
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:gav061697
ID: 1328517
Doesn't this still mean creating a class for each dialog?

I'm trying to avoid this because I have a lot of dialogs that I use in this way.
0
 
LVL 1

Expert Comment

by:Booth882
ID: 1328518
you have to create a class for each different dialog you are using.  if you want them all to have a common functionality, derive them all from one class, such as

class CBaseDlg : public CDialog
{
  // all the stuff you want it to do
};

class CFirstDlg : public CBaseDlg
{
  // individual workings
};

class CSecondDlg : public CBaseDlg
{
  // individual workings
};

this way you can synchronize how your dialogs work without writing the same code over and over.  also, if all of your child dialogs are the same except for the data the user puts in you can just have one class and make many instances of it.  
0
 

Author Comment

by:gav061697
ID: 1328519
I thought i'd have to do something like that...i was just hoping I didn't.
0
 
LVL 2

Accepted Solution

by:
wuxz earned 100 total points
ID: 1328520
I think you should create one dialog class at least, you can store a child dialog pointer in your dialog class. In its pretranslatemessage function, call the same function of its children one by one. Do you think it is a good idea :)

Regards

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

920 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

13 Experts available now in Live!

Get 1:1 Help Now