// opexeccersptesttdlistview.cpp : implementation file // #include "stdafx.h" #include "geomative.h" #include "opexeccersptesttdlistview.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern int g_iCurrListColIndex; extern int g_iCurrListColOrder; ///////////////////////////////////////////////////////////////////////////// // COpExecCERSPTestTdListView IMPLEMENT_DYNCREATE(COpExecCERSPTestTdListView, CListView) COpExecCERSPTestTdListView::COpExecCERSPTestTdListView() { } COpExecCERSPTestTdListView::~COpExecCERSPTestTdListView() { } BEGIN_MESSAGE_MAP(COpExecCERSPTestTdListView, CListView) //{{AFX_MSG_MAP(COpExecCERSPTestTdListView) ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick) ON_NOTIFY_REFLECT(LVN_INSERTITEM, OnInsertitem) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COpExecCERSPTestTdListView drawing void COpExecCERSPTestTdListView::OnDraw(CDC* pDC) { CDocument* pDoc = GetDocument(); // TODO: add draw code here } ///////////////////////////////////////////////////////////////////////////// // COpExecCERSPTestTdListView diagnostics #ifdef _DEBUG void COpExecCERSPTestTdListView::AssertValid() const { CListView::AssertValid(); } void COpExecCERSPTestTdListView::Dump(CDumpContext& dc) const { CListView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // COpExecCERSPTestTdListView message handlers void COpExecCERSPTestTdListView::OnInitialUpdate() { CListView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class CString strColTitle; LVCOLUMN lvCol; int iColIndex = (int)VAL_ZERO; lvCol.mask = LVCF_FMT; lvCol.fmt = LVCFMT_RIGHT; GetListCtrl().SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES); g_iCurrListColIndex = (int)VAL_ZERO; g_iCurrListColOrder = (int)VAL_ZERO; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_TD2DCON_TSN); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 55); GetListCtrl().SetColumn(iColIndex, &lvCol); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_TD2DCON_I); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 110); GetListCtrl().SetColumn(iColIndex, &lvCol); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_TD2DCON_V); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 110); GetListCtrl().SetColumn(iColIndex, &lvCol); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_TD2DCON_R0); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 110); GetListCtrl().SetColumn(iColIndex, &lvCol); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_TD2DCON_SP); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 110); GetListCtrl().SetColumn(iColIndex, &lvCol); } BOOL COpExecCERSPTestTdListView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Add your specialized code here and/or call the base class cs.style &= ~LVS_TYPEMASK; cs.style |= LVS_REPORT | LVS_SINGLESEL; return CListView::PreCreateWindow(cs); } void COpExecCERSPTestTdListView::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // TODO: Add your control notification handler code here g_iCurrListColIndex = pNMListView->iSubItem; g_iCurrListColOrder = !g_iCurrListColOrder; GetListCtrl().SortItems(ListStrCompare, (LPARAM)&GetListCtrl()); *pResult = 0; } void COpExecCERSPTestTdListView::OnInsertitem(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // TODO: Add your control notification handler code here // g_iCurrListColIndex = pNMListView->iSubItem; // g_iCurrListColOrder = !g_iCurrListColOrder; // GetListCtrl().SortItems(ListStrCompare, (LPARAM)&GetListCtrl()); *pResult = 0; }