Visual C++ Developer Center > Visual C++ Forums > Visual C++ Language > Navigation between dialog boxes
Ask a questionAsk a question
 

AnswerNavigation between dialog boxes

  • Wednesday, November 04, 2009 6:33 AMKEERV Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi

    I have a dialog displaying a few parameters and on pressing any key i need to move to the next dialog  say dialog-1. 

    Then I have the dialog box-1 which has few buttons. Each button should lead me to the respective custom dialogs.

    Then I need to return to the dialog box-1 from these custom dialogs when I press the back key.

    How do I go about implementing these navigations?

    Note- Am not using any preexisting dialog boxes.

Answers

All Replies

  • Wednesday, November 04, 2009 10:06 AMKEERV Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hey I figured out partially navigation implementations here..

    When You have to move from one dialog to the other say D1 to D2 on pressing any key,follow the steps:

    1)Create a class for the new dialog ie D2 with the base class as CDialog.
    2)Next add a member variable to the D1 class - of the type D2 class and give the access as private.(say m_dialog2)
    3)Next on the message WM_KEYDOWN add a function and add the following code:

    void CD1::OnButton()
    {
     // TODO: Add your message handler code here and/or call default
     
    if(m_dialog2.DoModal()==IDOK)
      UpdateData(FALSE);
     
     CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
    }

    For the above code only Enter and Space key are active.If i press any other key like the alphabets or numbers the navigation is not happening.. How do I go about this?
    How do i implement the back key navigation?
  • Tuesday, November 17, 2009 10:34 PMTom SerfaceMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    • Marked As Answer byKEERV Wednesday, November 18, 2009 5:51 AM
    •