BOOL CNewFile::OnInitDialog()
{
CNewFileRoot* pChildDialog = new CNewFileRoot();
m_pCurrentChildDlg=pChildDialog;
CTreeCtrl* pCtrl = (CTreeCtrl*) GetDlgItem(IDC_FILE_LIST);
ASSERT(pCtrl != NULL);
TV_INSERTSTRUCT tvinsert;
tvinsert.hParent=NULL;
tvinsert.hInsertAfter=TVI_LAST;
tvinsert.item.mask=TVIF_TEXT;
tvinsert.item.hItem=NULL;
tvinsert.item.pszText="Stammdaten";
HTREEITEM hRoot = pCtrl->InsertItem(&tvinsert);
HTREEITEM hPlus = pCtrl->InsertItem(TVIF_TEXT,
_T("Zusatzdaten"), 0, 0, 0, 0, 0, hRoot, NULL);
tvinsert.item.pszText="Kunde" ;
HTREEITEM hClient = pCtrl->InsertItem(&tvinsert);
HTREEITEM hClientPlus = pCtrl->InsertItem(TVIF_TEXT,
_T("Kunde Zusatzdaten"), 0, 0, 0, 0, 0, hClient, NULL);
return FALSE;
pChildDialog->Create( CNewFileRoot::IDD );
pChildDialog->SetParent(this);
pChildDialog->SetWindowPos( 0, 121, 0, 0,0, SWP_NOZORDER | SWP_NOSIZE );
pChildDialog->ShowWindow( SW_SHOW );
}
void CNewFile::OnSelchangedFileList(NMHDR* pNMHDR, LRESULT* pResult)
{
CTreeCtrl* pCtrl = (CTreeCtrl*) GetDlgItem(IDC_FILE_LIST);
ASSERT(pCtrl != NULL);
HTREEITEM hCurSel = pCtrl->GetNextItem(TVI_ROOT, TVGN_CARET);
if (hCurSel == NULL)
MessageBox(_T("Fehler"));
else
{
CString str;
str = pCtrl->GetItemText( hCurSel );
if(str == "Stammdaten")
{
m_pCurrentChildDlg->DestroyWindow();
CNewFileRoot* pChildDialog = new CNewFileRoot();
m_pCurrentChildDlg=pChildDialog;
pChildDialog->Create( CNewFileRoot::IDD );
pChildDialog->SetParent(this);
pChildDialog->SetWindowPos( 0, 121, 0, 0,0, SWP_NOZORDER | SWP_NOSIZE );
pChildDialog->ShowWindow( SW_SHOW );
}
else if(str == "Zusatzdaten")
{
if(m_pCurrentChildDlg)
{
m_pCurrentChildDlg->DestroyWindow();
}
CNewFileRootAddition* pRootDialog = new CNewFileRootAddition();
m_pCurrentChildDlg=pRootDialog;
pRootDialog->Create( CNewFileRootAddition::IDD );
pRootDialog->SetParent(this);
pRootDialog->SetWindowPos( 0, 121, 0, 0,0, SWP_NOZORDER | SWP_NOSIZE );
pRootDialog->ShowWindow( SW_SHOW );
}
}
*pResult = 0;
pNMHDR=NULL;
}