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::OnGbwSelectionChanged called when sorting Collapse All
Subject Author Date
Bob Sabiston Oct 18, 2005 - 4:51 PM

Hi:


I’m using a CExtGridWnd and need to monitor the changes in selection of the contents of the window.  I have provided an override for the


OnGbwSelectionChanged function and check the selection status with SelectionGetFirstRowInColumn etc.


When the selection changes, I go off and update other views in the application based on the selection.  This all works well however I notice that whenever I sort the grid with a column sort, I get a number of OnGbwSelectionChanged calls while sorting.


Is there a way to determine if the selection change was activated by a sort (and thus skip the expensive updating of the other views)?


 


Thanks


 


 

Technical Support Oct 19, 2005 - 3:53 AM

You could override the following virtual metho in a CExtGridWnd-derived class:

virtual bool GridSortOrderSetup(
    bool bSortColumns,
    const CExtGridDataSortOrder & _gdsoUpdate,
    bool bUpdateExistingSortOrder = false,
    bool bInvertIntersectionSortOrder = true,
    bool bRedraw = true
    );
This method is invoked to either set new sort rules or change the existing ones. In this method, invoke parent’s method with setting some flag to true before invocation and resetting it to false after it. The OnGbwSelectionChange() method should do nothing if the flag is set to true. Your GridSortOrderSetup() method should also finally analyze the selection.