newntui/activex/Impact/src/ArgumentsTableCtrl.cpp
// EditSubLabel		- Start edit of a sub item label
// Returns		- Temporary pointer to the new edit control
// nItem		- The row index of the item to edit
// nCol			- The column of the sub item.
EditSubLabel           - Start edit of a sub item label
Returns                - Temporary pointer to the new edit control
nItem          - The row index of the item to edit
nCol                   - The column of the sub item.
EditSubLabel - Start edit of a sub item label Returns - Temporary pointer to the new edit control nItem - The row index of the item to edit nCol - The column of the sub item .
CEdit* CArgumentsTableCtrl::EditSubLabel(int nItem, int nCol)
{
	if( !EnsureVisible( nItem, TRUE ) ) return NULL;
	CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
	int nColumnCount = pHeader->GetItemCount();
	if( nCol >= nColumnCount || GetColumnWidth(nCol) < 5 )
		return NULL;
	int offset = 0;
	for( int i = 0; i < nCol; i++ )
		offset += GetColumnWidth( i );
	CRect rect;
	GetItemRect( nItem, &rect, LVIR_BOUNDS );
	CRect rcClient;
	GetClientRect( &rcClient );
	if( offset + rect.left < 0 || offset + rect.left > rcClient.right )
	{
		CSize size;
		size.cx = offset + rect.left;
		size.cy = 0;
		Scroll( size );
		rect.left -= size.cx;
	}
	LV_COLUMN lvcol;
	lvcol.mask = LVCF_FMT;
	GetColumn( nCol, &lvcol );
	DWORD dwStyle ;
	if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT)
		dwStyle = ES_LEFT;
	else if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT)
		dwStyle = ES_RIGHT;
	else dwStyle = ES_CENTER;
	rect.left += offset+4;
	rect.right = rect.left + GetColumnWidth( nCol ) - 3 ;
	if( rect.right > rcClient.right) rect.right = rcClient.right;
	dwStyle |= WS_BORDER|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL;
	CEdit *pEdit = new CInPlaceEdit(nItem, nCol, GetItemText( nItem, nCol ));
	pEdit->Create( dwStyle, rect, this, IDC_IPEDIT );
	return pEdit;
}
CEdit * CArgumentsTableCtrl :: EditSubLabel ( int nItem , int nCol ) { if ( ! EnsureVisible ( nItem , TRUE ) ) return NULL ; CHeaderCtrl * pHeader = ( CHeaderCtrl * ) GetDlgItem ( 0 ) ; int nColumnCount = pHeader -> GetItemCount ( ) ; if ( nCol >= nColumnCount || GetColumnWidth ( nCol ) < 5 ) return NULL ; int offset = 0 ; for ( int i = 0 ; i < nCol ; i ++ ) offset += GetColumnWidth ( i ) ; CRect rect ; GetItemRect ( nItem , & rect , LVIR_BOUNDS ) ; CRect rcClient ; GetClientRect ( & rcClient ) ; if ( offset + rect . left < 0 || offset + rect . left > rcClient . right ) { CSize size ; size . cx = offset + rect . left ; size . cy = 0 ; Scroll ( size ) ; rect . left -= size . cx ; } LV_COLUMN lvcol ; lvcol . mask = LVCF_FMT ; GetColumn ( nCol , & lvcol ) ; DWORD dwStyle ; if ( ( lvcol . fmt & LVCFMT_JUSTIFYMASK ) == LVCFMT_LEFT ) dwStyle = ES_LEFT ; else if ( ( lvcol . fmt & LVCFMT_JUSTIFYMASK ) == LVCFMT_RIGHT ) dwStyle = ES_RIGHT ; else dwStyle = ES_CENTER ; rect . left += offset + 4 ; rect . right = rect . left + GetColumnWidth ( nCol ) - 3 ; if ( rect . right > rcClient . right ) rect . right = rcClient . right ; dwStyle |= WS_BORDER | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL ; CEdit * pEdit = new CInPlaceEdit ( nItem , nCol , GetItemText ( nItem , nCol ) ) ; pEdit -> Create ( dwStyle , rect , this , IDC_IPEDIT ) ; return pEdit ; }
EditSubLabel           - Start edit of a sub item label
Returns                - Temporary pointer to the new edit control
nItem          - The row index of the item to edit
nCol                   - The column of the sub item.
EditSubLabel - Start edit of a sub item label Returns - Temporary pointer to the new edit control nItem - The row index of the item to edit nCol - The column of the sub item .
// The returned pointer should not be saved // Make sure that the item is visible // Make sure that nCol is valid // Get the column offset // Now scroll if we need to expose the column // Get Column alignment