void CTDLFindTaskExpressionListCtrl::OnOperatorEditOK() { HideControl(m_cbOperators); // update operator type int nSel = m_cbOperators.GetCurSel(); if (nSel != CB_ERR) { CString sSel; m_cbOperators.GetLBText(nSel, sSel); int nRow = GetCurSel(); SetItemText(nRow, OPERATOR, sSel); // keep data store synched SEARCHPARAM& rule = m_aSearchParams[nRow]; FIND_OPERATOR nNewOp = (FIND_OPERATOR)m_cbOperators.GetItemData(nSel); rule.SetOperator(nNewOp); // if the op is set/notset then clear the field if (nNewOp == FOP_SET || nNewOp == FOP_NOT_SET) { rule.ClearValue(); } UpdateValueColumnText(nRow); ValidateListData(); } }
void CTDLFindTaskExpressionListCtrl::BuildListCtrl() { DeleteAllItems(); for (int nParam = 0; nParam < GetRuleCount(); nParam++) { const SEARCHPARAM& sp = m_aSearchParams[nParam]; // attrib CString sAttrib = m_cbAttributes.GetAttributeName(sp); int nItem = InsertItem(nParam, sAttrib); // operator CString sOp = GetOpName(sp.GetOperator()); SetItemText(nItem, OPERATOR, sOp); // value UpdateValueColumnText(nItem); // and/or (but not for last row) if (nParam < GetRuleCount() - 1) { CEnString sAndOr(sp.GetAnd() ? IDS_FP_AND : IDS_FP_OR); SetItemText(nItem, ANDOR, sAndOr); } } ValidateListData(); SetCurSel(0); }
void CTDLFindTaskExpressionListCtrl::OnAttribEditOK() { HideControl(m_cbAttributes); // update item text and keep data store synched int nRow = GetCurSel(); if (nRow != CB_ERR) { SEARCHPARAM& sp = m_aSearchParams[nRow]; SEARCHPARAM spNew(sp); if (m_cbAttributes.GetSelectedAttribute(spNew)) { sp = spNew; // update list text CString sAttrib = m_cbAttributes.GetSelectedAttributeText(); SetItemText(nRow, ATTRIB, sAttrib); // clear the operator cell text if the operator was no longer valid if (sp.OperatorIs(FOP_NONE)) SetItemText(nRow, OPERATOR, _T("")); UpdateValueColumnText(nRow); ValidateListData(); } } }
void CTDLFindTaskExpressionListCtrl::MoveSelectedRuleDown() { if (CanMoveSelectedRuleDown()) { int nRow, nCol; GetCurSel(nRow, nCol); // save off rule SEARCHPARAM sp = m_aSearchParams[nRow]; // delete rule m_aSearchParams.RemoveAt(nRow); DeleteItem(nRow); // reinsert rule nRow = InsertRule(nRow + 1, sp); // sanity check ValidateListData(); // restore selection SetCurSel(nRow, nCol); EnsureVisible(nRow, FALSE); } }
BOOL CTDLFindTaskExpressionListCtrl::DeleteSelectedCell() { int nRow, nCol; GetCurSel(nRow, nCol); if (nRow < GetRuleCount()) { if (nCol == ATTRIB) { CInputListCtrl::DeleteSelectedCell(); m_aSearchParams.RemoveAt(nRow); ValidateListData(); SetCurSel(nRow); return TRUE; } else if (nCol == VALUE) // clear text { SetItemText(nRow, nCol, _T("")); m_aSearchParams[nRow].ClearValue(); } } // else return FALSE; }
BOOL CTDLFindTaskExpressionListCtrl::DeleteSelectedRule() { int nRow = GetCurSel(); if (nRow != -1 && CanDeleteSelectedCell()) { DeleteItem(nRow); m_aSearchParams.RemoveAt(nRow); ValidateListData(); SetCurSel(nRow); EnsureVisible(nRow, FALSE); return TRUE; } return FALSE; }
void CTDLFindTaskExpressionListCtrl::OnAndOrEditOK() { HideControl(m_cbAndOr); // update operator type int nSel = m_cbAndOr.GetCurSel(); if (nSel != CB_ERR) { CString sSel; m_cbAndOr.GetLBText(m_cbAndOr.GetCurSel(), sSel); int nRow = GetCurSel(); SetItemText(nRow, ANDOR, sSel); // keep data store synched m_aSearchParams[nRow].SetAnd(m_cbAndOr.GetItemData(nSel)); ValidateListData(); } }