Export (0) Print
Expand All

CMultiPageDHtmlDialog Class

class CMultiPageDHtmlDialog : public CDHtmlDialog

Remarks

A multipage dialog displays multiple HTML pages sequentially and handles the events from each page. The mechanism for doing this is a DHTML and URL event map, which contains embedded event maps for each page.

Example

This multipage dialog assumes three HTML resources that define simple wizard-like functionality. The first page has a Next button, the second a Prev and Next button, and the third a Prev button. When one of the buttons is pressed, a handler function calls CDHtmlDialog::LoadFromResource to load the appropriate new page.

The pertinent parts of the class declaration (in CMyMultiPageDlg.h):

class CMyMultiPageDlg : public CMultiPageDHtmlDialog
{
public:
   // Declare the DHTML event handlers:
   HRESULT OnPage1Next(IHTMLElement *pElement);
   HRESULT OnPage2Next(IHTMLElement *pElement);
   HRESULT OnPage2Back(IHTMLElement *pElement);
   HRESULT OnPage3Back(IHTMLElement *pElement);
...
   DECLARE_DHTML_URL_EVENT_MAP()
}

The pertinent parts of the class implementation (in CMyMultipageDlg.cpp):

BEGIN_DHTML_URL_EVENT_MAP(CMyMultiPageDlg)

   BEGIN_EMBED_DHTML_EVENT_MAP(CMyMultiPageDlg, Page1)
      DHTML_EVENT_ONCLICK(_T("Next"), OnPage1Next)
   END_EMBED_DHTML_EVENT_MAP()

   BEGIN_EMBED_DHTML_EVENT_MAP(CMyMultiPageDlg, Page2)
      DHTML_EVENT_ONCLICK(_T("Back"), OnPage2Back)
      DHTML_EVENT_ONCLICK(_T("Next"), OnPage2Next)
   END_EMBED_DHTML_EVENT_MAP()

   BEGIN_EMBED_DHTML_EVENT_MAP(CMyMultiPageDlg, Page3)
      DHTML_EVENT_ONCLICK(_T("Back"), OnPage3Back)
   END_EMBED_DHTML_EVENT_MAP()

   BEGIN_URL_ENTRIES(CMyMultiPageDlg)
      URL_EVENT_ENTRY(CMyMultiPageDlg, _T("131"), Page1)
      URL_EVENT_ENTRY(CMyMultiPageDlg, _T("132"), Page2)
      URL_EVENT_ENTRY(CMyMultiPageDlg, _T("133"), Page3)
      // Note: IDR_PAGE1 = 131, IDR_PAGE2 = 132, IDR_PAGE3 = 133
   END_URL_ENTRIES()

END_DHTML_URL_EVENT_MAP(CMyMultiPageDlg)

HRESULT CMyMultiPageDlg::OnPage1Next(IHTMLElement *pElement)
{
   LoadFromResource(IDR_PAGE2);
   return S_OK;
}

HRESULT CMyMultiPageDlg::OnPage2Next(IHTMLElement *pElement)
{
   LoadFromResource(IDR_PAGE3);
   return S_OK;
}

HRESULT CMyMultiPageDlg::OnPage2Back(IHTMLElement *pElement)
{
   LoadFromResource(IDR_PAGE1);
   return S_OK;
}

HRESULT CMyMultiPageDlg::OnPage3Back(IHTMLElement *pElement)
{
   LoadFromResource(IDR_PAGE2);
   return S_OK;
}

Requirements

Header: afxdhtml.h

See Also

Class Members | CDHtmlDialog | Multipage DHTML and URL Event Maps

Show:
© 2014 Microsoft