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 » How to get a pointer of the hidden cell in the CExtGridWnd Collapse All
Subject Author Date
Devin Kim Nov 9, 2008 - 11:38 PM

CExtGridWnd wndMyGrid;


// grid setting ...... (column, style, ...)


wndMyGrid.AddRow(3);


wndMyGrid.RowHide(1);  // hide second row


CExtGridCellString * pCell =

    STATIC_DOWNCAST(

    CExtGridCellString,

    wndMyGrid.GridCellGet(

    0,

    1,     // I want to get a pointer of the hidden cell. But a third cell is returned.

    0,

    0,

    RUNTIME_CLASS(CExtGridCellString)

    )

    );

Technical Support Nov 14, 2008 - 12:17 PM

The CExtMDP::MappingEnable***() methods do more than just setting CExtMDP::m_bMappingEnabled***() properties to false. They clear indexing maps. That’s not what you need. You need just to change the CExtMDP::m_bMappingEnabledY() property to false temporarily. The source code should look like:

 CExtGridWnd & pGridWnd = . . .
CExtMDP < CExtGridDataProviderMemory > * pDP =
        static_downcast < CExtMDP < CExtGridDataProviderMemory > * >
        ( pGridWnd->OnGridQueryDataProvider() );
bool bSavedMappingEnabledY = pDP->m_bMappingEnabledY;
. . .
// TO-DO: access entire cell range of the pGridWnd window here . . .
// IMPORTANT: please do not show/hide rows in the pGridWnd window here.
. . .
    pDP->m_bMappingEnabledY = bSavedMappingEnabledY;

Technical Support Nov 11, 2008 - 7:34 AM

It’s not possible to get a pointer to a grid cell in hidden rows/columns using the CExtGridWnd class unless you show these previously hidden rows/columns. The row/column hiding feature was designed for grid filtering and we care about hiding performance only. The CExtGridWnd can hide rows one by one, but it can’t show a particular row. It can show all the previously hidden rows only. The same is for columns.

It’s possible to get any cell pointer by accessing grid data provider directly or coding your own data provider class. By default the CExtGridWnd control uses the CExtMDP < CExtGridDataProviderMemory > memory based data provider. The CExtMDP template class adds row/column hiding to default memory data provider implemented in the CExtGridDataProviderMemory class. The data provider is instantiated in the CExtGridWnd::OnGridQueryDataProvider() virtual method. You can temporarily set the CExtMDP::m_bMappingEnabledX and/or CExtMDP::m_bMappingEnabledY properties to false, access required grid cells and finally roll back changed mapping flags. This trick is temporarily turned off hidden row/column filter.

Devin Kim Nov 13, 2008 - 7:24 PM

I have tried to access CExtMDP::m_bMappingEnabledX and CExtMDP::m_bMappingEnabledY properties in the CExtGridWnd class, but I could not access directly.


  CExtGridDataProvider::public CObject, public CExtMDP_MappingAPI <-- not CExtMDP


So I can’t access properties of CExtMDP class. Besides, I called OnGridQueryDataProvider().MappingEnableX() and OnGridQueryDataProvider().MappingEnableY() functions instead of direct access ,but the result is not changed.


Could you offer me sample code to get a pointer of the hidden cell?


 




 


CExtGridWnd wndMyGrid;


// grid setting ...... (column, style, ...)


wndMyGrid.AddRow(3);


wndMyGrid.RowHide(1);  // hide second row


wndMyGrid.OnGridQueryDataProvider().MappingEnableY(false);


CExtGridCellString * pCell =

    STATIC_DOWNCAST(

    CExtGridCellString,

    wndMyGrid.GridCellGet(

    0,

    1,     // I want to get a pointer of the hidden cell. But still a third cell is returned.

    0,

    0,

    RUNTIME_CLASS(CExtGridCellString)

    )

    );


CExtGridCellString * pCell =

    STATIC_DOWNCAST(

    CExtGridCellString,

    wndMyGrid.GridCellGet(

    0,

    2,     // it makes ASSERT error. (Invalid row number)

    0,

    0,

    RUNTIME_CLASS(CExtGridCellString)

    )

    );


wndMyGrid.OnGridQueryDataProvider().MappingEnableY(true);