void EventDlg::UpdateColumnEntry(int iItem, int hcol, LPTSTR val) { UINT icol =ImpEditCol::m_fileheadermap[hcol]; // see this garbage? a result of poor design CString s; if (ImpEditCol::eMeasType == icol) // for string to numeric internal maps, handle the update differently { MEvent* pm = (MEvent*)m_List.GetItemData(iItem); if (pm) { CString szDisplayableResult; pm->UpdateMeasurementInfo(ImpEditCol::m_meacolmap[icol], val, szDisplayableResult); m_List.SetItemText(iItem,ImpEditCol::eMeasType,tMeasurementTypeImage((tMeasurementType)pm->m_vr._iMPMeasurementType)); } } else { if (UpdateValue(iItem , icol, val, s)) // icol is ImpEd enum { m_List.SetItemText(iItem , icol, s); } } }
LRESULT EventDlg::OnComboSelection(WPARAM nItem, LPARAM nSubItem) { CString sle = m_List.GetComboText(nItem, nSubItem); MEvent* pm = (MEvent*)m_List.GetItemData(nItem); if (pm) { CString szDisplayableResult; pm->UpdateMeasurementInfo(ImpEditCol::m_meacolmap[nSubItem], sle, szDisplayableResult); } return 0; }
bool EventDlg::UpdateValue(int iEntry, int iColumnID, LPCSTR pRawString, CString& szDisplayableResult) // column id is ImpEd enum { // get the list entry (MEvent) // update the relevant field on the MEvent // return false if the value does not match the allowed data ranges // otherwise return true so that the text can be inserted with the correct formatting in the list row subitem MEvent* pm = (MEvent*)m_List.GetItemData(iEntry); if (pm) { pm->UpdateMeasurementInfo(ImpEditCol::m_meacolmap[iColumnID], pRawString, szDisplayableResult); } return true; }