Controls in a subclassed Dialog

Hi

I have subclassed a dialog (with the help of an expert on here). That is, I have a dialog (DLGBase) which inherits from CDialog and I then created another dialog (DLGChild) which inherits from it.

What I was execting to happen was that any control I placed in DLGBase would automiatically be available in DGLChild. However, this is not the case. If I add controls to DLGBase they do not appear in DLGChild.

The reason I was attempting to do this was because the application I am writing will have many dialogs with common interfaces and rather than create each one individually I was going to use inheritance to cut down the work load.

Can anybody tell me how to do this?

John
IssacJonesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alb66Commented:
Simply call the constructor with the resource template IDD of the first dialog.
0
alb66Commented:
But I think that the best solution was the first I posted in the other thread:


class MySecondDialog : public MyFirstDialog
{
public:
      MySecondDialog(CWnd* pParent = NULL);   // costruttore standard
      virtual ~MySecondDialog();
}


MySecondDialog ::MySecondDialog (CWnd* pParent /*=NULL*/)
      : MyFirstDialog( pParent)
{
}

And then override in MySeconDialog only the function you need.
0
IssacJonesAuthor Commented:
Ah, yes, that makes sense, but doesn't that prevent me from adding controls to the child dialog i.e. if I use the IDD of the first dialog, any new controls I place in the second don't appear at runtime.

John
0
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

alb66Commented:
No, in this way they should appear because the constructor of base class CDialog will be called always with the IDD of MyFirstDialog. Did you tried?
0
alb66Commented:
Sorry, forget my previous comment
0
alb66Commented:
A way is to add all the control you need in the base class and then hide all the unwanted controls int the child
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IssacJonesAuthor Commented:
Hi alb66

I'm afraid it didn't work. The controls I have added to the second dialog do not appear. The only controls at appear in the second dialog are those from the first.

Ok, just seen second post. Ok, interesting. That's the way I have dealt with things in the past. I was curious if there was a more elegant solution.

John
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.