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 » CExtGridWnd virtual Collapse All
Subject Author Date
Hans Peter Miedeck Dec 6, 2006 - 9:25 AM

can you give me a Sample from a CExtGridWnd in virtual mode without ado? I only want see what I must change in my CExtGridWnd class, so that it work in virtual mode...

Hans Peter Miedeck Dec 20, 2006 - 7:26 AM

Who can I add a Row in the Grid?
I have a virtual grid now with 10000 rows... When i press a Button until my Grid, i want to add a row...

In a normal grid i make it so:

" mygrid.RowAdd( 1L, true );
LONG nRowNo = mygrid.RowCountGet()-1;

CExtGridCellStringDM * pCellText =
    STATIC_DOWNCAST(
    CExtGridCellStringDM,
    mygrid.GridCellGet(
    0L,
    nRowNo,
    0,
    0,
RUNTIME_CLASS(CExtGridCellStringDM)
    ));
    
pCellText->TextSet( "this is a test" );
"

so, when i make it in the virtual grid, my App crashs in the position with "mygrid.RowAdd( 1L, true );"

Technical Support Dec 21, 2006 - 11:18 AM

The cacheable grid window is based on the external data and you cannot insert rows into any kind cacheable grids. You can only modify the external data source and invoke grid’s SiwFireCacheChanging() method to refresh the cacheable grid including its scroll bars.

Hans Peter Miedeck Dec 13, 2006 - 12:36 AM

thanks...
i hope that sorting is no problem... ;)

Suhai Gyorgy Dec 13, 2006 - 1:31 AM

Thinking about sorting a little more: Having the grid do the sorting won’t work in case of virtual grid because any given time the grid only knows about the cached data inside of it, but not all the data. I think sorting has to be done inside Cache method, having the grid do only the presenting of the data and no computing at all.

Does it make any sense? :)

Chris

Hans Peter Miedeck Dec 12, 2006 - 9:27 AM

this work good, thanks...

only two more questions...

how can i sort now?

i have the following Method, but it not work anymore...

SortGrid(int iCol, bool bAsc)
{
    CExtGridDataSortOrder gdsoColumns;
    CExtGridDataSortOrder::ITEM_INFO _soii(
     iCol, // sort first column
        bAsc // true - ascending sort order, false - descending
);
    gdsoColumns.m_arrItems.Add( _soii );

    m_MyGrid.GridSortOrderSetup(
        false, // true - sort colums, false - sort rows
        gdsoColumns,
        false,
        false, // invert sort order
        true
    );
}

and, how can i deactivate the drag and drop function on the header?
your sample crash if i use the drag an drop function...

thank you

Technical Support Dec 13, 2006 - 5:47 AM

The cacheable grid control is based on external data and it does not know how to sort the data or how to re-arrange columns in the external data source. You should handle clicks on header cells by overriding the CExtGridCell::OnClick() or CExtGridBaseWnd::OnGbwAnalyzeMouseClick() virtual methods and implementing your own data sorting algorithm. The header cells allow you to display the built-in sort arrows using __EGCS_SORT_ARROW and __EGCS_SORT_DESCENDING cell styles. The drag-and-drop implementation should be based on the CExtGridWnd::OnGridOuterDragComplete() and CExtGridWnd::OnGridOuterDragOut() virtual methods without invoking parent class methods.

Suhai Gyorgy Dec 12, 2006 - 12:46 PM

The answer to your second question is easy: you have to call BseModifyStyleEx( 0L, __EGBS_BSE_EX_DRAG_COLUMNS|__EGBS_BSE_EX_DRAG_ROWS);

Sorry, I don’t have any idea on your sorting problem.

Technical Support Dec 11, 2006 - 11:19 AM

We are sorry for the delay with this reply. Please download a sample with a simple reusable grid class which implements a cacheable grid window. Insert the CCacheableGridBaseWnd class into your project first and implement a derived class. You can use the CMyGridWnd class from this sample as an example. As you can see only two virtual methods should be implemented for initializing both header cells and data cells. To cache the data initially, use the CCacheableGridBaseWnd::Cache() method like demonstrated in CDlg::OnInitDialog(). The CCacheableGridBaseWnd::Cache() method clears all the cached cells, header cells and scrolling information and initializes everything from scratch, including caching new data.