예제 #1
1
void CuDlgCacheTab::DisplayPage (CACHELINEINFO* pData)
{
	CString csButtonTitle;
	CWnd* pParent1 = GetParent ();              // View (CvDbmsCacheViewRight)
	ASSERT_VALID (pParent1);
	CWnd* pParent2 = pParent1->GetParent ();    // SplitterWnd
	ASSERT_VALID (pParent2);
	CWnd* pParent3 = pParent2->GetParent ();    // Frame (CfDbmsCacheFrame)
	ASSERT_VALID (pParent3);
	CWnd* pParent4 = pParent3->GetParent ();    // Modeless Dialog (CuDlgDbmsCache)
	ASSERT_VALID (pParent4);

	CWnd* pParent5 = pParent4->GetParent ();    // CTabCtrl
	ASSERT_VALID (pParent5);
	CWnd* pParent6 = pParent5->GetParent ();    // CConfRightDlg
	ASSERT_VALID (pParent6);

	CButton* pButton1 = (CButton*)((CConfRightDlg*)pParent6)->GetDlgItem (IDC_BUTTON1);
	CButton* pButton2 = (CButton*)((CConfRightDlg*)pParent6)->GetDlgItem (IDC_BUTTON2);

	CuCacheCheckListCtrl* pList = GetCacheListCtrl();
	CTabCtrl* pTab = (CTabCtrl*)GetDlgItem(IDC_TAB1);
	if (m_pCurrentPage)
	{
		//
		// Try to save (and validate) the data that has been changed
		// in the old page before displaying a new page.
		m_pCurrentPage->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)0);
		m_pCurrentPage->ShowWindow (SW_HIDE);
		m_pCurrentPage = NULL;
	}
	if (!(pTab && IsWindow (pTab->m_hWnd)))
		return;

	UINT nState = 0;
	int i, nCurSel = -1, nCount = pList->GetItemCount();
	for (i=0; i<nCount; i++)
	{
		nState = pList->GetItemState (i, LVIS_SELECTED);
		if (nState & LVIS_SELECTED)
		{
			nCurSel = i;
			break;
		}
	}
	if (nCurSel == -1)
		return;
	if (!pData)
		return;
	try
	{
		if (!VCBFllInitCacheParms(pData))
			return;
		int nSel = pTab->GetCurSel();
		switch (nSel)
		{
		case 0:
			csButtonTitle.LoadString(IDS_BUTTON_EDIT_VALUE);
			pButton1->SetWindowText (csButtonTitle);

			csButtonTitle.LoadString(IDS_BUTTON_RESTORE);
			pButton2->SetWindowText (csButtonTitle);
			if (!m_pCacheParameter)
			{
				m_pCacheParameter = new CuDlgDbmsCacheParameter (pTab);
				m_pCacheParameter->Create (IDD_DBMS_PAGE_CACHE_PARAMETER, pTab);
			}
			m_pCurrentPage = m_pCacheParameter;
			break;
		case 1:
			csButtonTitle.LoadString(IDS_BUTTON_EDIT_VALUE);
			pButton1->SetWindowText (csButtonTitle);

			csButtonTitle.LoadString(IDS_BUTTON_RECALCULATE);
			pButton2->SetWindowText (csButtonTitle);

			if (!m_pCacheDerived)
			{
				m_pCacheDerived = new CuDlgDbmsCacheDerived (pTab);
				m_pCacheDerived->Create (IDD_DBMS_PAGE_CACHE_DERIVED, pTab);
			}
			m_pCurrentPage = m_pCacheDerived;
			break;
		default:
			break;
		}
		if (m_pCurrentPage) 
		{
			CRect r;
			pTab->GetClientRect (r);
			pTab->AdjustRect (FALSE, r);
			m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, 0, 0);
			m_pCurrentPage->MoveWindow(r);
			m_pCurrentPage->ShowWindow(SW_SHOW);
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuDlgCacheTab::DisplayPage has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
}
예제 #2
0
LONG CPrefDlg::OnUpdateData (WPARAM wParam, LPARAM lParam)
{	
	BOOL bSyscheck = FALSE;
	CWaitCursor CWaitCur;
	try
	{
		if (VCBFll_settings_Init( &bSyscheck ))
			m_CButtonPreference.SetCheck( bSyscheck ); 
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CPrefDlg::OnUpdateData has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	return 0L;
}
예제 #3
0
void CPrefDlg::OnCheckPreference() 
{
	BOOL bCheckedResult;
	// TODO: Add your control notification handler code here
	try
	{
		if ( VCBFll_On_settings_CheckChanged(m_CButtonPreference.GetCheck(),
											&bCheckedResult))
			m_CButtonPreference.SetCheck( bCheckedResult ); 
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CPrefDlg::OnCheckPreference has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
}
예제 #4
0
void CConfRightDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	int nSel;
	CRect r;
	CWnd* pNewPage;
	CuPageInformation* pPageInfo;
	CWnd* pParent1 = GetParent();    // The view: CConfViewRight
	ASSERT (pParent1);
	CSplitterWnd* pParent2 = (CSplitterWnd*)pParent1->GetParent();  // The Splitter
	ASSERT (pParent2);
	CConfigFrame* pFrame = (CConfigFrame*)pParent2->GetParent();	// The Frame Window
	ASSERT (pFrame);

	if (!pFrame->IsAllViewsCreated())
		return;
	if (!m_pCurrentProperty)
		return;
	CWaitCursor waitCursor;
	m_cTab1.GetClientRect (r);
	m_cTab1.AdjustRect (FALSE, r);
	nSel = m_cTab1.GetCurSel();
	m_pCurrentProperty->SetCurSel(nSel);
	pPageInfo = m_pCurrentProperty->GetPageInfo();
	try
	{
		pNewPage  = GetPage (pPageInfo->GetDlgID (nSel));
		if (!pNewPage)
			return;
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage();
		e->Delete();
		return;
	}
	catch (CResourceException* e)
	{
		AfxMessageBox (_T("Fail to load resource"));
		e->Delete();
		return;
	}
	if (m_pCurrentPage)
	{
		//
		// Try to save (and validate) the data that has been changed
		// in the old page before displaying a new page.
		m_pCurrentPage->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem());
		m_pCurrentPage->ShowWindow (SW_HIDE);
	}
	m_pCurrentPage = pNewPage;
	m_pCurrentPage->MoveWindow (r);
	m_pCurrentPage->ShowWindow(SW_SHOW);
	m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, 0, (LPARAM)pPageInfo->GetCbfItem());

	*pResult = 0;
}
예제 #5
0
LONG CuEditableListCtrlGeneric::OnEditSpinDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	int iMin, iMax;
	CString s = EDITSPIN_GetText();
	if (s.IsEmpty())
	{
		EDITSPIN_GetRange (iMin, iMax);
		s.Format (_T("%d"), iMin);
	}
	EDITSPIN_GetEditItem(iItem, iSubItem);
	if (iItem < 0)
		return 0L;

	try
	{
		GENERICLINEINFO* pData = (GENERICLINEINFO*)GetItemData (iItem);
		if (pData)
		{
			CString strOldName = pData->szname;
			if (GetGenericForCache())
			{
				//
				// Special care of cache management.
				VCBFllCachePaneOnEdit (pData, (LPTSTR)(LPCTSTR)s);
			}
			else
			{
				VCBFllGenPaneOnEdit(pData, (LPTSTR)(LPCTSTR)s);
			}		ASSERT (strOldName == pData->szname);
			VCBF_GenericSetItem (this, pData, iItem);
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlGeneric::OnEditSpinDlgOK has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	return 0L;
}
예제 #6
0
LONG CuEditableListCtrlGenericDerived::OnEditSpinDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	int iMin, iMax;
	CString s = EDITSPIN_GetText();
	if (s.IsEmpty())
	{
		EDITSPIN_GetRange (iMin, iMax);
		s.Format (_T("%d"), iMin);
	}
	EDITSPIN_GetEditItem(iItem, iSubItem);
	if (iItem < 0)
		return 0L;
	try
	{
		DERIVEDLINEINFO* pData = (DERIVEDLINEINFO*)GetItemData (iItem);
		if (pData)
		{
			CString strOldName = pData->szname;
			BOOL bOk = VCBBllOnEditDependent(pData, (LPTSTR)(LPCTSTR)s);
			ASSERT (strOldName == pData->szname);
			VCBF_GenericDerivedAddItem (this, (LPCTSTR)strOldName, GetGenericForCache());
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlGenericDerived::OnEditSpinDlgOK has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	return 0L;
}
예제 #7
0
void CuEditableListCtrlGeneric::OnCheckChange (int iItem, int iSubItem, BOOL bCheck)
{
	TRACE1 ("CuEditableListCtrlGeneric::OnCheckChange (%d)\n", (int)bCheck);
	CString strOnOff = bCheck? "ON": "OFF";
	GENERICLINEINFO* pData = (GENERICLINEINFO*)GetItemData (iItem);

	try
	{
		if (pData)
		{
			CString strOldName = (LPCTSTR)pData->szname;
			if (GetGenericForCache())
			{
				//
				// Special care of cache management.
				VCBFllCachePaneOnEdit (pData, (LPTSTR)(LPCTSTR)strOnOff);
			}
			else
			{
				VCBFllGenPaneOnEdit(pData, (LPTSTR)(LPCTSTR)strOnOff);
			}
			ASSERT (strOldName == pData->szname);
			VCBF_GenericSetItem (this, pData, iItem);
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlGeneric::OnCheckChange has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
}
예제 #8
0
LONG CHistDlg::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
	LPTSTR szBufName;
	CWaitCursor wait;    // display wait cursor
	try
	{
		if ((szBufName =(LPTSTR) VCBFllLoadHist ( )) == NULL) {
			AfxMessageBox (IDS_ERR_LOAD_HISTORY);
			CString csTemp;
			csTemp.LoadString(IDS_ERR_LOAD_HISTORY);
			m_cstrhist.SetWindowText(csTemp);
		}
		else {
			m_cstrhist.SetWindowText((LPCTSTR)szBufName);
			m_cstrhist.LineScroll(m_cstrhist.GetLineCount( ));
			VCBFllFreeString( szBufName );
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CHistDlg::OnUpdateData has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}

	return 0L;
}
예제 #9
0
LONG CuEditableListCtrlComponent::OnEditDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	CString s = EDIT_GetText();
	EDIT_GetEditItem(iItem, iSubItem);
	if (iItem < 0) {
	  MessageBeep(MB_ICONEXCLAMATION);
			return 0L;
	}
	
	// optimization: if text not changed or if text empty, behave as if cancelled
	if (s.IsEmpty())
	  return 0L;
	if (s == m_EditDlgOriginalText)
	  return 0L;

  // Emb Oct 22, 97: don't accept underscore in name
  if (s.Find(_T('_')) != -1) {
    AfxMessageBox(IDS_ERR_UNDERSCORE);
  	SetItemText (iItem, iSubItem, m_EditDlgOriginalText);
    return 0L;    // As if not changed
  }

  // Emb Oct 22, 97: must check whether another item has the same name
  int count = GetItemCount();
  CuCbfListViewItem* pCurItemData = (CuCbfListViewItem*)GetItemData(iItem);
	LPCOMPONENTINFO lpCurComponentInfo = &pCurItemData->m_componentInfo;
  for (int cpt = 0; cpt < count; cpt++) {
    // exclude current item
    if (cpt == iItem)
      continue;

    // get component info of item
    CuCbfListViewItem* pItem = (CuCbfListViewItem*)GetItemData(cpt);
	  LPCOMPONENTINFO lpItemInfo = &pItem->m_componentInfo;

    // compare types
    if (lpItemInfo->itype != lpCurComponentInfo->itype)
      continue;

    // compare names - INSENSIVIVE
    if (s.CompareNoCase((LPCTSTR)lpItemInfo->szname) != 0)
      continue;

    // same type and name : denied
    AfxMessageBox(IDS_ERR_DUPLICATE_NAME);
  	SetItemText (iItem, iSubItem, m_EditDlgOriginalText);
    return 0L;    // As if not changed
  }

	// Emb Sept 25, 97: preliminary test at low level side
	CuCbfListViewItem* pItemData = (CuCbfListViewItem*)GetItemData(iItem);
	LPCOMPONENTINFO lpComponentInfo = &pItemData->m_componentInfo;
	AfxGetApp()->DoWaitCursor(1);
	try
	{
		BOOL bSuccess = VCBFllValidRename(lpComponentInfo, (LPTSTR)(LPCTSTR)s);
		AfxGetApp()->DoWaitCursor(-1);
		if (!bSuccess)
			MessageBeep(MB_ICONEXCLAMATION);
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlComponent::OnEditDlgOK has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	// always display text as returned in the structure by VCBFllValidRename()
	SetItemText (iItem, iSubItem, (LPCTSTR)lpComponentInfo->szname);

	return 0L;
}
예제 #10
0
LONG CuEditableListCtrlComponent::OnEditSpinDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	CString s = EDITSPIN_GetText();

	// optimization: if text not changed or if text empty, behave as if cancelled
	if (s.IsEmpty())
	  return 0L;
	if (s == m_EditSpinDlgOriginalText)
	  return 0L;

	EDITSPIN_GetEditItem(iItem, iSubItem);
	if (iItem < 0) {
	  MessageBeep(MB_ICONEXCLAMATION);
			return 0L;
	}
	// DBCS Compliant
	// Oct 23, 97: skip leading Zero(s)
	int len = s.GetLength();
	if (len > 1) {
		int cpt=0;
		for (cpt=0; cpt<len; cpt++)
			if (s[cpt] != _T('0'))
				break;
		if (cpt == len)
			s = _T("0"); // Only zeros found
		else
		s = s.Right(len-cpt);		// start from first non-zero digit
	}
 
	// Emb Sept 25, 97: preliminary test at low level side
	CuCbfListViewItem* pItemData = (CuCbfListViewItem*)GetItemData(iItem);
	LPCOMPONENTINFO lpComponentInfo = &pItemData->m_componentInfo;
	AfxGetApp()->DoWaitCursor(1);
	try
	{
		BOOL bSuccess = VCBFllValidCount(lpComponentInfo, (LPTSTR)(LPCTSTR)s);
		AfxGetApp()->DoWaitCursor(-1);
		if (!bSuccess)
			MessageBeep(MB_ICONEXCLAMATION);
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlComponent::OnEditSpinDlgOK has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	
	// always display text as returned in the structure by VCBFllValidRename()
	SetItemText (iItem, iSubItem, (LPCTSTR)lpComponentInfo->szcount);
	return 0L;
}
예제 #11
0
void CConfRightDlg::DisplayPage (CuPageInformation* pPageInfo)
{
	CRect   r;
	TC_ITEM item;
	int     i, nPages;
	UINT*   nTabID;
	UINT*   nDlgID;
	CString strTab;
	CString strTitle;
	UINT    nIDD; 
	CWnd* pDlg;
	CView*   pView = (CView*)GetParent();               ASSERT (pView);
	
	//
	// Set the default label of the two buttons: (Derfault, Restore)
	CWnd* pB1 = GetDlgItem (IDC_BUTTON1);
	CWnd* pB2 = GetDlgItem (IDC_BUTTON2);
	CString csButtonTitle;
	csButtonTitle.LoadString(IDS_BUTTON_EDIT_VALUE);
	pB1->SetWindowText (csButtonTitle);

	csButtonTitle.LoadString(IDS_BUTTON_RESTORE);
	pB2->SetWindowText (csButtonTitle);

	pB1->EnableWindow  (FALSE);
	pB2->EnableWindow  (FALSE);


	// hide buttons 1 and 2 if no page
	int showFlag = SW_HIDE;
	if (pPageInfo && pPageInfo->GetNumberOfPage() > 0)
		showFlag = SW_SHOW;
	pB1->ShowWindow(showFlag);
	pB2->ShowWindow(showFlag);

	// Always Hide the other buttons
	CWnd* pB3 = GetDlgItem (IDC_BUTTON3);
	CWnd* pB4 = GetDlgItem (IDC_BUTTON4);
	CWnd* pB5 = GetDlgItem (IDC_BUTTON5);
	pB3->ShowWindow(SW_HIDE); pB3->SetWindowText(_T("Button &3"));
	pB4->ShowWindow(SW_HIDE); pB4->SetWindowText(_T("Button &4"));
	pB5->ShowWindow(SW_HIDE); pB5->SetWindowText(_T("Button &5"));

	// always enable all buttons
	pB1->EnableWindow(TRUE);
	pB2->EnableWindow(TRUE);
	pB3->EnableWindow(TRUE);
	pB4->EnableWindow(TRUE);
	pB5->EnableWindow(TRUE);

	if (m_bIsLoading)
	{
		m_bIsLoading = FALSE;
	}
	if (!pPageInfo)
	{
		if (m_pCurrentPage)
		{
			//
			// Try to save (and validate) the data that has been changed
			// in the old page before displaying a new page.
			m_pCurrentPage->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)0);
			m_pCurrentPage->ShowWindow (SW_HIDE);
		}
		m_cTab1.DeleteAllItems();
		if (m_pCurrentProperty)
		{
			m_pCurrentProperty->SetPageInfo (NULL);
			delete m_pCurrentProperty;
			m_pCurrentProperty = NULL;
			m_pCurrentPage     = NULL;
		}
		return;
	}
	if (!m_pCurrentProperty)
	{
		try
		{
			m_pCurrentProperty = new CuCbfProperty (0, pPageInfo);
		}
		catch (CMemoryException* e)
		{
			VCBF_OutOfMemoryMessage();
			e->Delete();
			m_pCurrentPage = NULL;
			m_pCurrentProperty = NULL;
			return;
		}
		//
		// Set up the Title:
		pPageInfo->GetTitle (strTitle);
		
		nPages = pPageInfo->GetNumberOfPage();
		if (nPages < 1)
		{
			m_pCurrentPage = NULL;
			return;
		}
		//
		// Construct the Tab(s)
		nTabID = pPageInfo->GetTabID();
		nDlgID = pPageInfo->GetDlgID();
		memset (&item, 0, sizeof (item));
		item.mask       = TCIF_TEXT;
		item.cchTextMax = 32;
		m_cTab1.DeleteAllItems();
		for (i=0; i<nPages; i++)
		{
			strTab.LoadString (nTabID [i]);
			item.pszText = (LPTSTR)(LPCTSTR)strTab;
			m_cTab1.InsertItem (i, &item);
		}
		//
		// Display the default (the first in general) page,
		int iPage = pPageInfo->GetDefaultPage ();
		nIDD    = pPageInfo->GetDlgID (iPage);
		try 
		{
			pDlg= GetPage (nIDD);
			if (!pDlg)
				return;
		}
		catch (CMemoryException* e)
		{
			VCBF_OutOfMemoryMessage ();
			e->Delete();
			return;
		}
		catch (CResourceException* e)
		{
			AfxMessageBox (_T("Load resource failed"));
			e->Delete();
			return;
		}
		m_cTab1.SetCurSel (iPage);
		m_cTab1.GetClientRect (r);
		m_cTab1.AdjustRect (FALSE, r);
		pDlg->MoveWindow (r);
		pDlg->ShowWindow(SW_SHOW);
		m_pCurrentPage = pDlg;
		m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem());
	}
	else
	{
		CuPageInformation* pCurrentPageInfo = m_pCurrentProperty->GetPageInfo();
		if (pCurrentPageInfo->GetClassName()==pPageInfo->GetClassName())
		{
			m_pCurrentProperty->SetPageInfo (pPageInfo);
			//
			// In general, when the selection changes on the left-pane, 
			// and if the new selected item if the same class as the old one
			// then we keep the current selected page (Tab) at the right-pane.
			// Special case:
			// ------------
			// For the class LOGFILE, we use the default page setting !!!
			if (pCurrentPageInfo->GetClassName()== "LOGFILE")
			{
				int iPage = pPageInfo->GetDefaultPage ();
				nIDD      = pPageInfo->GetDlgID (iPage);
				CWnd* pDlg= GetPage (nIDD);
				if (!pDlg)
					return;
				m_cTab1.SetCurSel (iPage);
				m_cTab1.GetClientRect (r);
				m_cTab1.AdjustRect (FALSE, r);
				if (m_pCurrentPage)
				{
					//
					// Try to save (and validate) the data that has been changed
					// in the old page before displaying a new page.
					m_pCurrentPage->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)0);
					m_pCurrentPage->ShowWindow (SW_HIDE);
				}
				pDlg->MoveWindow (r);
				pDlg->ShowWindow(SW_SHOW);
				m_pCurrentPage = pDlg;
			}
			//
			// wParam, and lParam will contain the information needed
			// by the dialog to refresh itself.
			if (m_pCurrentPage) 
				m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem());
		}
		else
		{
			if (m_pCurrentPage) 
			{
				//
				// Try to save (and validate) the data that has been changed
				// in the old page before displaying a new page.
				m_pCurrentPage->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)0);
				m_pCurrentPage->ShowWindow (SW_HIDE);
			}
			m_cTab1.DeleteAllItems();
			nPages = pPageInfo->GetNumberOfPage();
			m_pCurrentProperty->SetPageInfo (pPageInfo);
			m_pCurrentProperty->SetCurSel (0);
			
			if (nPages < 1)
			{
				m_pCurrentPage = NULL;
				return;
			}
			UINT nIDD; 
			CWnd* pDlg;
			//
			// Construct the Tab(s)
			nTabID = pPageInfo->GetTabID();
			nDlgID = pPageInfo->GetDlgID();
			memset (&item, 0, sizeof (item));
			item.mask       = TCIF_TEXT;
			item.cchTextMax = 32;
			m_cTab1.DeleteAllItems();
			for (i=0; i<nPages; i++)
			{
				strTab.LoadString (nTabID [i]);
				item.pszText = (LPTSTR)(LPCTSTR)strTab;
				m_cTab1.InsertItem (i, &item);
			}
			//
			// Display the default (the first) page.
			int iPage = pPageInfo->GetDefaultPage ();
			nIDD    = pPageInfo->GetDlgID (iPage);
			try 
			{
				pDlg= GetPage (nIDD);
				if (!pDlg)
					return;
			}
			catch (CMemoryException* e)
			{
				VCBF_OutOfMemoryMessage();
				e->Delete();
				return;
			}
			catch (CResourceException* e)
			{
				AfxMessageBox (_T("Load resource failed"));
				e->Delete();
				return;
			}
			m_cTab1.SetCurSel (iPage);
			m_cTab1.GetClientRect (r);
			m_cTab1.AdjustRect (FALSE, r);
			pDlg->MoveWindow (r);
			pDlg->ShowWindow(SW_SHOW);
			m_pCurrentPage = pDlg;
			m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem());
		}
	}
}