/*
Modified version of InsertColumn to accomodate for the sort type and sort state
*/
int CMultiColumnSortListCtrl::InsertColumn( int nCol, SORT_TYPE nType, SORT_STATE nDefaultSort, LPCTSTR lpszColumnHeading, int nFormat /*= LVCFMT_LEFT*/, int nWidth /*= -1*/, int nSubItem /*= -1*/ )
{
	int nRes = CListCtrl::InsertColumn( nCol, lpszColumnHeading, nFormat, nWidth, nSubItem );
	
	SetColumnType(nRes, nType);
	SetDefaultItemSortState(nRes, nDefaultSort);
	
	return nRes;
}
/*
Modified version of InsertColumn to accomodate for the sort type and sort state
*/
int CMultiColumnSortListCtrl::InsertColumn( int nCol, SORT_TYPE nType, SORT_STATE nDefaultSort, const LVCOLUMN* pColumn )
{
	int nRes = CListCtrl::InsertColumn( nCol, pColumn );

	SetColumnType(nRes, nType);
	SetDefaultItemSortState(nRes, nDefaultSort);

	return nRes;
}
void CTDLFindTaskExpressionListCtrl::PreSubclassWindow() 
{
	// create child controls
	CreateControl(m_cbAttributes, ATTRIB_ID);
	CreateControl(m_cbOperators, OPERATOR_ID, FALSE);
	CreateControl(m_cbAndOr, ANDOR_ID, FALSE);
	CreateControl(m_dtcDate, DATE_ID);
	CreateControl(m_eTime, TIME_ID);
	CreateControl(m_cbListValues, LISTVALUES_ID);
	CreateControl(m_cbPriority, PRIORITY_ID);
	CreateControl(m_cbRisk, RISK_ID);

	CInputListCtrl::PreSubclassWindow(); // we need combo to be created first

	// build and/or combo too
	int nItem = m_cbAndOr.AddString(CEnString(IDS_FP_AND));
	m_cbAndOr.SetItemData(nItem, TRUE);
				
	nItem = m_cbAndOr.AddString(CEnString(IDS_FP_OR));
	m_cbAndOr.SetItemData(nItem, FALSE);

	// post message for our setup
	m_header.EnableTracking(FALSE);
	ShowGrid(TRUE, TRUE);

	InsertColumn(ATTRIB, CEnString(IDS_FT_ATTRIB), LVCFMT_LEFT, 120);
	InsertColumn(OPERATOR, CEnString(IDS_FT_MATCHES), LVCFMT_LEFT, 160);
	InsertColumn(VALUE, CEnString(IDS_FT_VALUE), LVCFMT_LEFT, 130);
	InsertColumn(ANDOR, CEnString(IDS_FT_ANDOR), LVCFMT_LEFT, 60);
	SetView(LVS_REPORT);
//	SetLastColumnStretchy(TRUE);

	AutoAdd(TRUE, FALSE);

	BuildListCtrl();

	SetColumnType(ATTRIB, ILCT_DROPLIST);
	SetColumnType(OPERATOR, ILCT_DROPLIST);
	SetColumnType(ANDOR, ILCT_DROPLIST);
}