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 » CExtReportGridWnd nodes containing children. Collapse All
Subject Author Date
Eric Houvenaghel Oct 18, 2006 - 1:18 PM

There are a few thing I would like to modify in the CExtReportGridWnd if possible.
For the nodes that CONTAIN children:
1. What is the best way to change the width of the node?
I would like to make the nodes the same size as the childless ones.
2. I would like to display, in the node itself, the number of children that the node has.
3. I would also like, in some situations, to change the colour of the node.

Thx for your help

Technical Support Oct 21, 2006 - 11:52 AM

The width of group rows in the report grid window is always equal to summary widths of all the active report columns. This is true both when the columns are stretched automatically to fit the available width and when the columns are not stretched automatically and you can make the report grid’s contents enough wide to see the horizontal scroll bar visible. We think the width of the group rows is currently implemented correctly. So, please provide us with more details about how you would like to adjust it?

The CExtReportGridWnd::OnReportGridPaintGroupRow() virtual method is invoked to paint the report group row completely. It invokes the CExtReportGridWnd::OnReportGridFormatGroupRowText() virtual method for getting the text displayed in the group row and the CExtReportGridWnd::OnTreeGridPaintExpandButton() virtual method to draw the expand button. You can override any of these methods. By overriding CExtReportGridWnd::OnReportGridFormatGroupRowText(), you can display the number of the child group rows or data rows. For example, you can get the number of child rows in this way:

void CExtReportGridWnd::OnReportGridFormatGroupRowText(
    const CExtReportGridItem * pRGI,
    CExtSafeString & strRowText,
    LONG nGroupIndex
    ) const
{
    ASSERT_VALID( this );
    ASSERT_VALID( pRGI );
    ASSERT( nGroupIndex >= 0 );
    nGroupIndex;
    strRowText.Empty();
LONG nChildCount = ItemGetChildCount( (HTREEITEM)pRGI );
    strRowText.Format( _T("CHILD COUNT = %d"), nChildCount );
}
You can change the background of a group row by overriding the CExtReportGridWnd::OnReportGridPaintGroupRow() virtual method. Just copy the original method’s body and change the code that paints the background.

Eric Houvenaghel Oct 24, 2006 - 2:08 PM

Thank you for the reply.
Everything works good now excepty for the width problem.
I think you’re thinking of the horizontal width.
Let me restate the question:

What is the best way to change the vertical width of the node that contain children?

Thanks.

PS: This is the second time I’m posting this reply. I clicked on "post" the first time but my responce didn’t show up in the thread.

Technical Support Oct 25, 2006 - 11:43 AM

The CExtReportGridWnd::OnReportGridQueryItemExtraSpace() method calculates additional heights in pixels above and below the group row. The default method implementation detects whether the report grid uses Outlook XP or Outlook 2003/2007 layout and computes corresponding extra spaces.

Eric Houvenaghel Oct 25, 2006 - 1:16 PM

Thanks.
That works great.
I have another question.
I would like to shift the childless nodes to the right when grouping.
Just like the node that have children are shifted to the right.

Technical Support Oct 26, 2006 - 12:14 PM

The indent for all rows is calculated in the CExtTreeGridWnd::OnGbwAdjustRects() virtual method. You can override it and specify your own row indent for grid cells in column 0. You can detect the row type using this code:

HTREEITEM hti = ItemGetByVisibleRowIndex( nRowNo );
    ASSERT( hti != NULL );
    if( ItemGetChildCount( hti ) == 0 )
    {
        // this row is data row
    }