Hello,
I have developed a simple dialog application using classes - CXTPPropertySheet and CXTPPropertyPage.
I am adding 5 pages in to the property sheet. Please refer the code. I want to display a modeless dialog so I am using 'Create' and 'ShowWindow' functions.
I am not able to navigate to any page other than the fisrt active page. When I click any of the pages first active page always gets displayed.
If I create modal dialog (by calling DoModal) then this problem is not seen. Please let me know what might be the reason.
Function 'OnInitDialog' of the page I am trying to navigate to gets called. I found that we fail in function 'CXTPPropertyPage::CreatePage' while executing this statement -
if (!LoadTemplate(hTemplate, hInstance))
return FALSE;
I am not getting the cause. If anybody knows about modeless dilaog using CXTPPropertySheet then please reply on priority.
-------------------------------------- Code --------------------------------------------------------------
JFEAOptimizationMainDlg* m_pOptimizeDlg;
if (NULL == m_pOptimizeDlg)
{
m_pOptimizeDlg = new JFEAOptimizationMainDlg( this, this);
if (!m_pOptimizeDlg)
{
hr_exit(E_OUTOFMEMORY);
}
if (m_pOptimizeDlg)
{
CXTPPropertyPageListNavigator* pList = new CXTPPropertyPageListNavigator();
pList->SetListStyle(xtListBoxOffice2007);
m_pOptimizeDlg->SetNavigator(pList);
m_pOptimizeDlg->SetResizable();
m_pOptimizeDlg->SetPageSize(CSize(350, 250)); // in dialog units
// First page is active page.
m_pOptimizeDlg->SetActivePage(0);
// Add pages.
m_pOptimizeDlg->AddPage(&m_pOptimizeDlg->m_DesOptObjectivePage);
m_pOptimizeDlg->AddPage(&m_pOptimizeDlg->m_DesOptLimitsPage);
m_pOptimizeDlg->AddPage(&m_pOptimizeDlg->m_DesOptVariablesPage);
m_pOptimizeDlg->AddPage(&m_pOptimizeDlg->m_DesOptCtrlParamPage);
m_pOptimizeDlg->AddPage(&m_pOptimizeDlg->m_DesOptConvParamPage);
// Set dialog title.
utDilaogTitle.LoadStringResource(hInstPrevious, IDS_FEA_OPTIMIZATION_TITLE);
m_pOptimizeDlg->SetTitle(utDilaogTitle);
// Show the dialog
if(!IsWindow(hWnd))
{
if (m_pOptimizeDlg->Create(this, WS_SYSMENU | WS_POPUP | WS_CAPTION DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE)
{
m_pOptimizeDlg->ShowWindow(SW_SHOW);
m_pOptimizeDlg->UpdateWindow();
}
}
else
{
m_pOptimizeDlg->ShowWindow(SW_SHOW);
}
}
---------------------------------- Code Ends -------------------------------------------------
------------- Thanks & Regards, Satyenjit Bagal. Software Development Engineer. SIEMENS Automation and Drives.
|