示例#1
0
BOOL CEditWatchPoint::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	// TODO: Add your specialized code here and/or call the base class

	HD_NOTIFY *pHDNotify = (HD_NOTIFY*)lParam;

	switch( pHDNotify->hdr.code )
	{
	case HDN_ITEMCLICKA:
	case HDN_ITEMCLICKW:
		{
			// left mouse button.
			if (pHDNotify->iButton == 0)
			{
				if (pHDNotify->iItem == m_nSortedCol) 
				{
					m_bAscending = !m_bAscending;
				}
				else 
				{
					m_bAscending = true;
				}
			}
			// right mouse button.
			else if (pHDNotify->iButton == 1) 	
			{
				m_bAscending = m_flatHeader.GetAscending();
			}
			else 
			{
				break;
			}
			// set sort image for header.
			m_nSortedCol = pHDNotify->iItem;
			m_flatHeader.SetSortImage (m_nSortedCol, m_bAscending);
			// TODO: Add your sorting code here.
			//if(wParam==IDC_LIST_SAMPLEPOINT)
		//	if(wParam==1310)
		//	{
			CXTSortClass csc (&m_ctrlListPoint, m_nSortedCol);
			if((m_nSortedCol==4)||(m_nSortedCol==2))
				csc.Sort (m_bAscending ? true : false, DT_STRING);
			else
				csc.Sort (m_bAscending ? true : false, DT_INT);

			CXTSortClass csc1 (&m_ctrlListWatch, m_nSortedCol);
			csc1.Sort (m_bAscending ? true : false, DT_INT);
		//	}
		}
	}
	return CDialog::OnNotify(wParam, lParam, pResult);
}
示例#2
0
void CPointEditAnologIn::SetListHead()
{
	//m_ctrlListConv
	m_ctrlList.InsertColumn(0, _T("通道"),   LVCFMT_CENTER, 36);
	m_ctrlList.InsertColumn(1, _T("点号"),   LVCFMT_CENTER, 36);
	m_ctrlList.InsertColumn(2, _T("标签"),   LVCFMT_CENTER, 60);
	m_ctrlList.InsertColumn(3, _T("转接器类型"), LVCFMT_CENTER, 72);
	m_ctrlList.InsertColumn(4, _T("频率"), LVCFMT_CENTER, 36);
	m_ctrlList.InsertColumn(5, _T("扫描"),   LVCFMT_CENTER, 36);
	m_ctrlList.InsertColumn(6, _T("值域最小值"),   LVCFMT_CENTER, 72);
	m_ctrlList.InsertColumn(7, _T("值域最大值"),   LVCFMT_CENTER, 72);
	m_ctrlList.InsertColumn(8, _T("单位"),   LVCFMT_CENTER, 36);
	m_ctrlList.InsertColumn(9, _T("精度"),   LVCFMT_CENTER, 36);
	m_ctrlList.InsertColumn(10, _T("处理类型"),   LVCFMT_CENTER, 60);
	m_ctrlList.InsertColumn(11, _T("报警类"),   LVCFMT_CENTER, 48);
	m_ctrlList.InsertColumn(12, _T("报警下限"),   LVCFMT_CENTER, 60);
	m_ctrlList.InsertColumn(13, _T("报警上限"),   LVCFMT_CENTER, 60);
	m_ctrlList.InsertColumn(14, _T("报警模式"),   LVCFMT_CENTER, 60);
	m_ctrlList.InsertColumn(15, _T("报警延迟"),   LVCFMT_CENTER, 60);
	m_ctrlList.InsertColumn(16, _T("其它说明"),   LVCFMT_CENTER, 90);

	// set some extnded styles
	m_ctrlList.SetExtendedStyle (LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_FLATSB);

	// Get the windows handle to the header control for the
	// list control then subclass the control.
	HWND hWndHeader = m_ctrlList.GetDlgItem(0)->GetSafeHwnd();
	m_flatHeader.SubclassWindow (hWndHeader);

	// initialize the back color picker default colors.
	m_cpBack.SetColor(RGB(0x33,0x66,0xff));
	m_cpBack.SetDefaultColor(m_clrRowBack);

	// initialize the text color picker default colors.
	m_cpText.SetColor(RGB(0xff,0xff,0xff));
	m_cpText.SetDefaultColor(m_clrRowText);

	// set the text and back colors for the list control.
	m_ctrlList.SetRowColors(m_cpText.GetColor(), m_cpBack.GetColor());

	m_bAscending=TRUE;
	m_nSortedCol=0;

	m_flatHeader.SetSortImage (m_nSortedCol, m_bAscending);

			// TODO: Add your sorting code here.
	CXTSortClass csc (&m_ctrlList, m_nSortedCol);
	csc.Sort (m_bAscending ? true : false, DT_INT);
}
示例#3
0
void CEditWatchPoint::SetPointListHead()
{
	m_ctrlListPoint.InsertColumn(0, _T("地址"),   LVCFMT_CENTER, 10);
	m_ctrlListPoint.InsertColumn(1, _T("点号"),   LVCFMT_CENTER, 10);
	m_ctrlListPoint.InsertColumn(2, _T("转接器类型"),LVCFMT_LEFT, 40);
	m_ctrlListPoint.InsertColumn(4, _T("扫描"),   LVCFMT_CENTER, 10);
	m_ctrlListPoint.InsertColumn(5, _T("频率"),   LVCFMT_CENTER, 10);
	// set some extnded styles
	m_ctrlListPoint.SetExtendedStyle (LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_FLATSB);

	// Get the windows handle to the header control for the
	// list control then subclass the control.
	HWND hWndHeader = m_ctrlListPoint.GetDlgItem(IDC_LISTWATCH)->GetSafeHwnd();
	m_flatHeader.SubclassWindow (hWndHeader);

//	if (m_bSaveColumnWidth)
//		m_ctrlListSamplePoint.LoadColumnWidths();

	// size to fit the columns
	m_ctrlListPoint.AutoSizeColumn ();

	// initialize the back color picker default colors.
	m_cpBack.SetColor(RGB(0x33,0x66,0xff));
	m_cpBack.SetDefaultColor(m_clrRowBack);

	// initialize the text color picker default colors.
	m_cpText.SetColor(RGB(0xff,0xff,0xff));
	m_cpText.SetDefaultColor(m_clrRowText);

	// set the text and back colors for the list control.
	m_ctrlListPoint.SetRowColors(m_cpText.GetColor(), m_cpBack.GetColor());

	m_bAscending=TRUE;
	m_nSortedCol=0;

	m_flatHeader.SetSortImage (m_nSortedCol, m_bAscending);

			// TODO: Add your sorting code here.
	CXTSortClass csc (&m_ctrlListPoint, m_nSortedCol);
	csc.Sort (m_bAscending ? true : false, DT_INT);
}
bool CShortcutBarView::SortList(int /*nCol*/, bool /*bAscending*/)
{
	CXTSortClass csc (&GetListCtrl(), m_nSortedCol);
	csc.Sort (m_bAscending, xtSortString);
	return true;
}