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 » Walking data in the CExtReportGridWnd control Collapse All
Subject Author Date
Christophe Guibert Aug 12, 2007 - 2:18 PM

Hello,
I’m currently using the powerful CExtReportGridWnd to display structured data and would like to walk the columns and rows in the order their have been left by the user in the grid, including collapsed rows.

Using ReportColumnGetStartPosition() and ReportColumnGetNext() enumerate the displayed columns in the order they were registered, not the user order.

Using the ItemGetRoot() and ItemGetNext() enumerate only the shown rows (not those which are collapsed when one or several fields are used as group criteria).

Could you please give hints to :
- walk columns in the order they are displayed in the grid ?
- walk rows in the order where they appear, even when not expanded ?

Thank you in advance,

Best Regards,

Christophe Guibert

Suhai Gyorgy Aug 12, 2007 - 2:57 PM

This is how ItemGetNext is shown in Help file:

virtual HTREEITEM ItemGetNext(
   HTREEITEM hTreeItem,
   bool bSiblingOnly,
   bool bExpandedWalk,
   bool bWalkDeeper
) const;
Though I didnt try, but I guess if you use false as 3rd parameter, it should give you collapsed items as well. If it doesn’t, it might be a bug.

Christophe Guibert Aug 13, 2007 - 1:24 PM

I thank you for your suggestion, but collapsed items are not traversed whatever the parameter I give, especially the third.

In Prof-UIS 2.80, there’s even a fourth boolean parameter (bIncludeHidden, not yet documented), and it seems to have no effect.
Is this a bug ?

The other point is to enumerate columns in the order they are set by the end-user. Any idea ?

Best Regards,

Christophe Guibert

Technical Support Aug 14, 2007 - 2:54 AM

The CExtTreeGridWnd::Item***() APIs are based on HTREEITEM handles and can be used for accessing any tree row. But if you want to access visible rows, you should use the CExtGridWnd class APIs (including its based classes) which are based on plain row indices. The CExtGridWnd::OnSiwGetVisibleRange() method returns a CRect object with the first/last displayed row indices in the CRect::top and CRect::bottom members. In order to convert the plain row indices into HTREEITEM handles and vice versa, you should use the CExtTreeGridWnd::ItemGetByVisibleRowIndex() and CExtTreeGridWnd::ItemGetVisibleIndexOf() methods. So, you can enumerate the entire scrollable range from zero up to CExtGridWnd::RowCountGet()-1 or visible row range returned by the CExtGridWnd::OnSiwGetVisibleRange() method.

Christophe Guibert Aug 15, 2007 - 1:37 PM

Dear Technical Support,

Considering a tree like this one :
root:
-item 1
-child item 2
-child item 3
-item 4
-child item 5

When using ItemGetNext() from the root, it will walk the tree until reaching -child item3 with siblingOnly=false, then return null and not the item 4. Is this on purpose ?

Nevertheless, I’ve built a recursive function to walk the tree, using ItemGetNext and ItemGetParent , changing siblingOnly, and building a list of pointers to items. This satisfy my need.

Thank you for your support.

Best Regards

Christophe Guibert

Suhai Gyorgy Aug 14, 2007 - 2:34 AM

I use this code to walk the columns in the order they appear on the screen.

	LONG lColNo = ColumnCountGet();
	for (LONG l = 0L; l < lColNo; l++)
	{
		CExtReportGridColumn *pRGC = (CExtReportGridColumn *)GridCellGetOuterAtTop(l, 0L);
		// do something here
	}

In my testing, it seems that ItemGetNext(hItem, false, false, true, false); gives just what you need. Can you reproduce the problem in a small sample application?

Christophe Guibert Aug 14, 2007 - 4:34 PM

Hello Suhai,

Thank you for the column order trick which works fine !

However, the ItemGetNext(hItem, false, false, true, false); does not work for me : only one leaf row item is enumerated from the tree root when grouping is used, and whatever the group item state : expanded or collapsed. The only correct behavior is when the tree is flat (no groups).

Still searching a way to enumerate both collapsed and expanded row items in the ReportGrid.

Best Regards,

Christophe Guibert