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 » Painting sorted column differently Collapse All
Subject Author Date
Suhai Gyorgy Jul 26, 2007 - 9:08 AM

Dear Support,

I’d like to add a feature to our CExtReportGridWnd which I saw in Outlook 2003. There the background is slightly darker in the column by which the grid is sorted (but not grouped). There can only be at most one column like that. I guess I have to override OnGbwQueryBackColor method for this.

1. How can I access the CExtReportGridColumn associated with the given cell in this method? (I know how to get CExtReportGridItem, but that doesn’t give me any information in this case)

2. If I access the CExtReportGridColumn object somehow, should I use CExtReportGridSortOrder::ColumnGetIndexOf method to find out if the grid is sorted by that column or not? I see there’s a CExtReportGridColumn::SortingAscendingGet method, but what does it return if grid is not sorted by that column at all (Help says: "Returns true if the column is sorted in ascending order or false if it is sorted in descending order.")

3. On the other way around, from a CExtReportGridSortOrder object, how can I find out which column is the one (if there’s any) by which the grid is sorted, but not grouped? Is it the last one "in the list of columns by which the report grid is sorted and/or grouped"?

Thank you very much!

Technical Support Jul 30, 2007 - 9:16 AM

We are sorry for the delay with this reply. The nColNo parameter of the CExtGridBaseWnd::OnGbwQueryBackColor() method provides you with the plain active column index. The outer header column at the top of the report grid control returned by the CExtGridWnd::GridCellGetOuterAtTop() method is a CExtReportGridColumn object. You should use the CExtReportGridSortOrder::ColumnGetIndexOf() method to detect whether the report grid is sorted or grouped by the specified column. The CExtReportGridSortOrder::ColumnCountGet() method returns the total number of columns including for grouping and sorting. The CExtReportGridSortOrder::ColumnGroupCountGet() method returns the number of columns for grouping. The report grid control is sorted by both kind of columns, but it is sorted by grouped columns first. So, if you need to highlight the sorted background, then the index returned by the CExtReportGridSortOrder::ColumnGetIndexOf() method should not be negative and should be greater or equal to the value returned by the CExtReportGridSortOrder::ColumnGroupCountGet() method.

Suhai Gyorgy Jul 30, 2007 - 9:37 AM

Thank you, my solution was very close to this, but yours is much safer coding!

Suhai Gyorgy Jul 30, 2007 - 7:48 AM

Never mind, I got this one working. Thank you anyways!