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 General Discussion » CExtGridWnd Cell Editing Collapse All
Subject Author Date
Benjamin Gorman Jan 14, 2008 - 6:20 PM

I created a grid using the same code as in the SimpleGrids sample but it is in a dialog window. Editing of the cells is not working.
Here is the code I used to create the grid. Any ideas?

void CPostionLocationDlg::CreateGrid()
{
    CExtGridCell * pColHeaderCell = NULL;
    CExtGridCell * pRowHeaderCell = NULL;
    CString colHdrLabel;
    CString rowHdrLabel;

    // Allow for column labels and row labels

    m_Grid.SiwModifyStyle(
        __ESIS_STH_PIXEL|__ESIS_STV_PIXEL|__EGBS_SFB_CELLS|__EGBS_NO_HIDE_SELECTION
            |__EGBS_RESIZING_CELLS_OUTER|__EGBS_RESIZING_CELLS_INNER
            |__EGBS_FIXED_SIZE_COLUMNS|__EGBS_FIXED_SIZE_ROWS
            //|__EGBS_DYNAMIC_RESIZING_H|__EGBS_DYNAMIC_RESIZING_V
            |__EGBS_GRIDLINES
            ,
        0,
        false
        );
    m_Grid.SiwModifyStyleEx(
        __EGBS_EX_HVI_EVENT_CELLS //|__EGBS_EX_HVO_EVENT_CELLS
        |__EGBS_EX_HVI_HIGHLIGHT_CELL //|__EGBS_EX_HVO_HIGHLIGHT_CELL
        |__EGBS_EX_CELL_TOOLTIPS_OUTER|__EGBS_EX_CELL_EXPANDING_INNER
        //|__EGBS_EX_CORNER_AREAS_3D|__EGBS_EX_CORNER_AREAS_CURVE
        ,
        0,
        false
        );
    m_Grid.BseModifyStyle(
        __EGWS_BSE_WALK|__EGWS_BSE_EDIT_CELLS_INNER|__EGWS_BSE_EDIT_CELLS_OUTER,
        0,
        false
        );

    // Delete any existing columns just to be sure
    // Then add a column for each interface
    m_Grid.RowRemoveAll( FALSE );
    m_Grid.ColumnRemoveAll( FALSE );

    // Allow for column labels and row labels
    m_Grid.OuterRowCountTopSet( 1, false );
    m_Grid.OuterColumnCountLeftSet( 1, false );

    m_Grid.ColumnAdd( eMaxGeoFilterAreaPointsGridCols, false );
    m_Grid.RowAdd( cMaxGeoFilterAreaPointsRows, false );

    // Set up each column
    for (int col=0; col<eMaxGeoFilterAreaPointsGridCols; col++)
    {
        // Set the corresponding column header text and size
        pColHeaderCell =
            m_Grid.GridCellGetOuterAtTop(
                col,
                0,
                RUNTIME_CLASS(CExtGridCellHeader)
            );
        ASSERT_VALID( pColHeaderCell );
        pColHeaderCell->ModifyStyle(
            __EGCS_EX_DISABLE_SORT
            |__EGCS_TA_HORZ_CENTER
            );

        pColHeaderCell->TextSet( "" );
        pColHeaderCell->ExtentSet( cGeoFilterAreaPointsGridColHdrExtent );
    }

    // Set up the row headers
    for (unsigned int row = 0; row < cMaxGeoFilterAreaPointsRows; row++)
    {
        // Set the corresponding row header text
        pRowHeaderCell =
            m_Grid.GridCellGetOuterAtLeft(
                0,
                row,
                RUNTIME_CLASS(CExtGridCellHeader)
            );
        ASSERT_VALID( pRowHeaderCell );
        pRowHeaderCell->ModifyStyle(
            __EGCS_HDR_ROW_COLUMN_NUMBER
            |__EGCS_TA_HORZ_RIGHT
            );
    }

    // Set the width of the row header to be relatively small
    m_Grid.OuterColumnWidthSet(TRUE, 0, cGeoFilterAreaPointsGridRowHdrExtent);

    // Resize the scrollbars depending on the number
    // of cells are used
    m_Grid.OnSwUpdateScrollBars();

    // Refresh the grid
    m_Grid.OnSwDoRedraw();
}

Technical Support Jan 21, 2008 - 3:01 AM

In your code we cannot find how you are creating cells. Please noter that it is not enough to create a grid and just add rows and columns. When you insert a row to the grid, the cells in this row are empty by default (do not exist) . Because of that, you should initialize (create) them using corresponding cell classes. You can see how it can be done in our sample applications.