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 » Location of Cells when sorting grid data Collapse All
Subject Author Date
David Skok Jun 22, 2006 - 12:40 PM

I am using a CExtGridWnd to edit and display data. Data in the grid can be changed outside of my program through ethernet or serial and I need to update the display. If data is sorted using the grid control how can i find the new location of a cell knowing the original row/column that it was located in. Note that no new rows or columns are added, just the data changes. I have been using an STL Set with the cells as keys (with extra data) but I came across the CExtGridDataSortOrder and don’t understand how it works.

Thanks

Technical Support Jun 23, 2006 - 10:50 AM

Thank you for the interesting question. The sorting of the grid rows/columns is implemented wiht a data provider component, which controls all cell objects and their locations in the two dimensional grid’s space. When a new sort order is applied for rows/columns or existing sort order is updated, the data provider invokes the CExtGridWnd::OnDataProviderSwapSeries() virtual method to notify the grid window about each row/column swapping event. The grid window uses this method to modify selection regions during sorting. This method allows you to watch row movements during sorting and keep your external references to the data inside the grid window in the correct state. Additionally, the start and end of sorting algorithm can be caught by overriding the CExtGridWnd::OnDataProviderSortEnter() and CExtGridWnd::OnDataProviderSortLeave() virtual methods. You may also need to track the drag-and-drop of rows/columns if this feature is enabled in your grid window. This can be done by overriding of the CExtGridWnd::OnDataProviderSwapDroppedSeries() virtual method.