MariusTrola
MariusTrola

Reputation: 17

MFC C++ - How to call Init() in new dialog opened with button in Main Dialog

I use VS 2013. I am new into MFC and I have already created Dialog box with button which opens new dialog. I call constructor of the new dialog in Event_button_handler and use method DoModal. It works perfectly.

But my problem appears when I want to add for example Slider Control in new dialog. I followed this tutorial: http://depts.washington.edu/cmmr/biga/chapter_tutorials/1.C++_MFC_D3DOGL/1.StepByStepGuide/tutorial_3.html but there is no such method like OnInit(); which I used in my main dialog.

How can I handle this? Thanks

Upvotes: 0

Views: 1410

Answers (1)

Barmak Shemirani
Barmak Shemirani

Reputation: 31669

OnInitDialog should look like this:

BOOL CMyDialog::OnInitDialog()
{
    BOOL res = CDialog::OnInitDialog();
    //... initialize slider
    return res;
}

That tutorial skips an important line CDialog::OnInitDialog();

Upvotes: 1

Related Questions