Professional UI Solutions
Site Map   /  Register


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


    // 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 =
        ASSERT_VALID( pColHeaderCell );

        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 =
        ASSERT_VALID( pRowHeaderCell );

    // 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

    // Refresh the grid

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.