Solved

Child Dialogs

Posted on 1999-01-29
7
276 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
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

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Complete beginner needs help making a cron job 9 131
MaxSpan challenge 9 124
How to convert MFC::CString to UTF8 wchar_t* 10 387
Message not shown 5 87
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

730 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