Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtGridCellNumber Set and Get Collapse All
Subject Author Date
Paul Cowan Feb 1, 2007 - 2:45 PM

CExtGridCellNumber seems to be missing to very important methods, a Set and Get to initialize and read the numeric value in the cell. What am I missing, there must be a way of doing it.

Technical Support Feb 2, 2007 - 5:06 AM

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;
}



Suhai Gyorgy Feb 2, 2007 - 2:47 AM

You can use CExtGridCell::GetVariant to get and CExtGridCellVariant::_VariantAssign to set the value in your number cell. CExtGridCellNumber is derived from CExtGridCellVariant, so both methods are available for you.