void CReportCtrl::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; int Col = pNMListView->iSubItem; SortRows(Col); *pResult = 0; }
void CReportCtrl::SortRows(int SortCol) { if (SortCol == m_SortCol) // same column as last time? m_SortDir = -m_SortDir; // y, reverse sort order else m_SortDir = m_Column[SortCol].InitSort; // n, set default sort order SortRows(SortCol, m_SortDir); }
void CReportCtrl::SortRows(int SortCol, int SortDir) { if (m_Style & SORT_ARROWS) DrawSortArrow(m_SortCol, -1); // erase previous column's arrow if (m_Style & SORT_ARROWS) DrawSortArrow(SortCol, SortDir < 0); // draw new arrow m_SortDir = SortDir; m_SortCol = SortCol; SortRows(); }
bool CReportCtrl::LoadHeaderState(LPCTSTR Key, LPCTSTR SubKey) { DWORD hsz = CalcHeaderStateSize(m_Columns); HEADER_STATE *ph = (HEADER_STATE *)new BYTE[hsz]; ZeroMemory(ph, hsz); bool retc = CPersist::GetBinary(Key, SubKey, ph, &hsz) != 0; if (retc) { SortRows(ph->SortCol, ph->SortDir); int cols = ph->Columns; int *pColWidth = &ph->ColInfo[cols]; for (int i = 0; i < cols; i++) SetColumnWidth(i, pColWidth[i]); SetColumnOrderArray(cols, ph->ColInfo); } delete ph; return(retc); }
void CReportCtrl::AddRow(int SortKey) { int row = GetItemCount(); InsertCallbackRow(row, SortKey); SortRows(); }
/** * * * @author OLiver */ void ctrlTable::Msg_ButtonClick(const unsigned int ctrl_id) { SortRows(ctrl_id - 1); }