HBREADCRUMBITEM CBCGPBreadcrumb::GetSubItemByName (HBREADCRUMBITEM hParentItem, const CString& itemName) const { int n = GetSubItemsCount (hParentItem); for (int i = 0; i < n; ++i) { HBREADCRUMBITEM hSubItem = GetSubItem (hParentItem, i); if (GetItemText (hSubItem).CompareNoCase (itemName) == 0) { return hSubItem; } } return NULL; }
BOOL CBoundedNumberPairProp::OnUpdateValue() { ASSERT_VALID(this); ASSERT_VALID(m_pWndInPlace); ASSERT_VALID(m_pWndList); ASSERT(::IsWindow(m_pWndInPlace->GetSafeHwnd())); CString strText; m_pWndInPlace->GetWindowText(strText); BOOL bIsChanged = FormatProperty() != strText; if (bIsChanged) { CString strDelimeter(_T(",")); for (int i = 0; !strText.IsEmpty() && i < GetSubItemsCount(); i++) { CString strItem = strText.SpanExcluding(strDelimeter); if (strItem.GetLength() + 1 > strText.GetLength()) { strText.Empty(); } else { strText = strText.Mid(strItem.GetLength() + 1); } strItem.TrimLeft(); strItem.TrimRight(); int nItem = _ttoi(strItem); if ((i == 0) && ((nItem < m_nMinValue1) || (nItem > m_nMaxValue1))) { static BOOL bRecursedHere = FALSE; if (bRecursedHere) return TRUE; bRecursedHere = TRUE; CString strMessage; strMessage.Format(_T("Height value must be between %d and %d."), m_nMinValue1, m_nMaxValue1); AfxMessageBox(strMessage); bRecursedHere = FALSE; return FALSE; } else if ((i == 1) && ((nItem < m_nMinValue2) || (nItem > m_nMaxValue2))) { static BOOL bRecursedHere = FALSE; if (bRecursedHere) return TRUE; bRecursedHere = TRUE; CString strMessage; strMessage.Format(_T("Width value must be between %d and %d."), m_nMinValue2, m_nMaxValue2); AfxMessageBox(strMessage); bRecursedHere = FALSE; return FALSE; } } return CMFCPropertyGridProperty::OnUpdateValue(); } return TRUE; }