/*---------------------------------------------------------------------------------------------- Process notifications from user. ----------------------------------------------------------------------------------------------*/ bool GeneralPropDlgTab::OnNotifyChild(int ctid, NMHDR * pnmh, long & lnRet) { AssertPtr(pnmh); if (m_fInitialized) { switch (pnmh->code) { case EN_KILLFOCUS: { if (pnmh->idFrom == m_ctidName) { StrAppBufHuge strbh; int cch = ::SendDlgItemMessage(m_hwnd, m_ctidName, WM_GETTEXT, strbh.kcchMaxStr, (LPARAM)strbh.Chars()); strbh.SetLength(cch); if (cch) { FixString(strbh); ::SetWindowText(::GetDlgItem(m_hwnd, m_ctidName), strbh.Chars()); if (!m_ppropd->CheckName(strbh.Chars())) { StrApp strA(kstidTlsLstsNameExist); StrApp strB(kstidTlsLstsNameExistC); ::MessageBox(m_hwnd, strA.Chars(), strB.Chars(), MB_OK | MB_ICONINFORMATION); ::SetFocus(::GetDlgItem(m_hwnd, m_ctidName)); return false; } m_ppropd->SetName(strbh.Chars()); } else // List must have a name. ::SetWindowText(::GetDlgItem(m_hwnd, m_ctidName), m_ppropd->GetName()); } else if (pnmh->idFrom == kctidGeneralPropTabDescription) { StrAppBufHuge strbh; int cch = ::SendDlgItemMessage(m_hwnd, kctidGeneralPropTabDescription, WM_GETTEXT, strbh.kcchMaxStr, (LPARAM)strbh.Chars()); strbh.SetLength(cch); FixString(strbh); ::SetWindowText(::GetDlgItem(m_hwnd, kctidGeneralPropTabDescription), strbh.Chars()); m_ppropd->SetDescription(strbh.Chars()); } } break; } } return AfWnd::OnNotifyChild(ctid, pnmh, lnRet); }
/*---------------------------------------------------------------------------------------------- Replaces any carriage returns, linefeeds, or tabs with a space, then trim leading and trailing spaces. ----------------------------------------------------------------------------------------------*/ void GeneralPropDlgTab::FixString(StrAppBufHuge & strbh) { int ich = strbh.FindStr(_T("\r\n")); while (ich > -1) { strbh.Replace(ich, ich + 2, " "); ich = strbh.FindStr(_T("\r\n")); } ich = strbh.FindStr(_T("\n")); while (ich > -1) { strbh.Replace(ich, ich + 1, " "); ich = strbh.FindStr(_T("\n")); } ich = strbh.FindStr(_T("\t")); while (ich > -1) { strbh.Replace(ich, ich + 1, " "); ich = strbh.FindStr(_T("\t")); } while (strbh.Left(1) == _T(" ")) { strbh = strbh.Right(strbh.Length() - 1); } while (strbh.Right(1) == _T(" ")) { strbh = strbh.Left(strbh.Length() - 1); } }
/*---------------------------------------------------------------------------------------------- Process notifications from user. ----------------------------------------------------------------------------------------------*/ bool DetailsPropDlgTab::OnNotifyChild(int ctid, NMHDR * pnmh, long & lnRet) { AssertPtr(pnmh); if (m_fInitialized) { switch (pnmh->code) { case BN_CLICKED: { switch (pnmh->idFrom) { case kctidDetailsPropTabSort: { if (IsDlgButtonChecked(m_hwnd, kctidDetailsPropTabSort) == BST_CHECKED) m_ppropd->SetSorted(true); else m_ppropd->SetSorted(false); break; } case kctidDetailsPropTabDup: { if (IsDlgButtonChecked(m_hwnd, kctidDetailsPropTabDup) == BST_CHECKED) m_ppropd->SetDuplicates(true); else m_ppropd->SetDuplicates(false); break; } case kctidDetailsPropTabHeir: { if (IsDlgButtonChecked(m_hwnd, kctidDetailsPropTabHeir) == BST_CHECKED) m_ppropd->SetDepth(127); else m_ppropd->SetDepth(1); break; } case kctidDetailsPropTabBrws: { OnBrws(); break; } } break; } case EN_KILLFOCUS: { switch (pnmh->idFrom) { case kctidDetailsPropTabAbbr: { StrAppBufHuge strbh; int cch = ::SendDlgItemMessage(m_hwnd, kctidDetailsPropTabAbbr, WM_GETTEXT, strbh.kcchMaxStr, (LPARAM)strbh.Chars()); strbh.SetLength(cch); if (cch) m_ppropd->SetAbbr(strbh.Chars()); else // List must have an abbreviation. ::SetWindowText(::GetDlgItem(m_hwnd, kctidDetailsPropTabAbbr), m_ppropd->GetAbbr()); break; } case kctidDetailsPropTabHelpF: { StrAppBufHuge strbh; int cch = ::SendDlgItemMessage(m_hwnd, kctidDetailsPropTabHelpF, WM_GETTEXT, strbh.kcchMaxStr, (LPARAM)strbh.Chars()); strbh.SetLength(cch); m_ppropd->SetHelpFile(strbh.Chars()); break; } } break; } case CBN_SELCHANGE: { switch (pnmh->idFrom) { case kctidDetailsPropTabDisp: { int icbo = ::SendDlgItemMessage(m_hwnd, kctidDetailsPropTabDisp, CB_GETCURSEL, 0, 0); m_ppropd->SetDispOpt(icbo); break; } case kctidDetailsPropTabWS: { int icbo = ::SendDlgItemMessage(m_hwnd, kctidDetailsPropTabWS, CB_GETCURSEL, 0, 0); switch (icbo) { case 0: m_ppropd->SetWs(kwsAnals); break; case 1: m_ppropd->SetWs(kwsVerns); break; case 2: m_ppropd->SetWs(kwsAnalVerns); break; case 3: m_ppropd->SetWs(kwsVernAnals); break; } break; } } break; } } } return AfWnd::OnNotifyChild(ctid, pnmh, lnRet); }