In additional, you can invoke the CEdit::SetLimitText()
method for the cell inplace edit. You can do this by overriding the OnInplaceControlCreate()
virtual method in your cell class:
HWND CMyGridCell::OnInplaceControlCreate(
CExtGridWnd & wndGrid,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
const RECT & rcCellExtra,
const RECT & rcCell,
const RECT & rcInplaceControl,
LONG nLastEditedColNo,
LONG nLastEditedRowNo
)
{
ASSERT_VALID( this );
ASSERT_VALID( (&wndGrid) );
DWORD dwCellStyle = GetStyle();
if( (dwCellStyle&__EGCS_NO_INPLACE_CONTROL) != 0 )
return NULL;
HWND hWndOuter =
wndGrid.OnGridCellInplaceControlCreate(
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl,
nLastEditedColNo,
nLastEditedRowNo
);
if( hWndOuter != NULL )
return hWndOuter;
CExtGridInplaceEdit * pEdit = NULL;
try
{
pEdit =
new CExtGridInplaceEdit(
wndGrid,
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl,
nLastEditedColNo,
nLastEditedRowNo
);
ASSERT_VALID( pEdit );
if( ! pEdit->Create() )
{
ASSERT( FALSE );
return NULL;
} // if( ! pEdit->Create() )
} // try
catch( CException * pXept )
{
ASSERT( FALSE );
pXept->Delete();
return NULL;
} // catch( CException * pXept )
catch( ... )
{
ASSERT( FALSE );
return NULL;
} // catch( ... )
ASSERT_VALID( pEdit );
pEdit-> SetLimitText( ... );
HWND hWnd = pEdit->GetSafeHwnd();
ASSERT( hWnd != NULL && ::IsWindow(hWnd) );
return hWnd;
}