Exemple #1
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;
}
Exemple #2
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;
}
Exemple #3
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;
}