Solved

Child Dialogs

Posted on 1999-01-29
7
277 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
[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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 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