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 » Resizing rows in a ReportGrid Collapse All
Subject Author Date
Suhai Gyorgy Dec 20, 2007 - 4:24 AM

Dear Support,

I’m having trouble when I want to let the users resize the rows in a reportgrid. I could reproduce it in your ReportGrid sample, as well. I apply __EGBS_RESIZING_CELLS_INNER_V style with SiwModifyStyle method. With this style set, the cursor changes to the proper arrow when hovering over the inner horizontal lines, and I can drag the line ( I see the tracking line as expected). But when I release the mouse button, the row is not resized.

I’ve examined your code and I see that the row is resized with a CExtGridCell::ExtentSet call in CExtGridWnd::OnGbwResizingStateApply method. No surprise there. But the application doesn’t get to this call, a previous GridCellGet call returns NULL. I know, it’s because the outer header cell on the left is not initialized as a type of CExtGridCellHeader. No problem, I do that right after registering the report item. I put the same code in your sample, as well:

pCell = GridCellGet(0, nRow, -1, 0, RUNTIME_CLASS(CExtGridCellHeader));
ASSERT_VALID(pCell);


Checking your code again, I see that now pCell->ExtentSet is called in CExtGridWnd::OnGbwResizingStateApply, great. It doesn’t even return false. Even OnSwDoRedraw is called at the end of the same method. Still, the result is the same, the row is not resized after dragging the tracking line. Of course dynamic resizing doesn’t work either, of the same reason, I guess.

Could you please check this issue? I guess even the header cell initialization should be placed somewhere in your code. Thank you!

Technical Support Dec 24, 2007 - 10:40 AM

We are sorry for the delay with this reply and thank you for reporting this issue. To fix it, please update the source code of the following method

INT CExtTreeGridWnd::OnSiwQueryItemExtentV(
      LONG nRowNo,
      INT * p_nExtraSpaceBefore, // = NULL
      INT * p_nExtraSpaceAfter   // = NULL
      ) const
{
      ASSERT_VALID( this );
      ASSERT( nRowNo >= 0 );
      if( p_nExtraSpaceBefore != NULL )
            (*p_nExtraSpaceBefore) = 0;
      if( p_nExtraSpaceAfter != NULL )
            (*p_nExtraSpaceAfter) = 0;
      if(         FixedSizeRowsGet()
            ||    OuterColumnCountLeftGet() > 0
            ||    OuterColumnCountRightGet() > 0
            )
            return
                  CExtGridWnd::OnSiwQueryItemExtentV(
                        nRowNo,
                        p_nExtraSpaceBefore,
                        p_nExtraSpaceAfter
                        );
HTREEITEM hTreeItem = ItemGetByVisibleRowIndex( nRowNo );
      if( hTreeItem == NULL )
            return
                  CExtGridWnd::OnSiwQueryItemExtentV(
                        nRowNo,
                        p_nExtraSpaceBefore,
                        p_nExtraSpaceAfter
                        );
CExtTreeGridCellNode * pCell =
            CExtTreeGridCellNode::FromHTREEITEM( hTreeItem );
      ASSERT_VALID( pCell );
INT nItemExtent, nExtraSpaceAfter = 0, nExtraSpaceBefore = 0;
      if( ! pCell->ExtentGet( nItemExtent, 0 ) )
            return
                  CExtGridWnd::OnSiwQueryItemExtentV(
                        nRowNo,
                        p_nExtraSpaceBefore,
                        p_nExtraSpaceAfter
                        );
      pCell->ExtraSpaceGet( nExtraSpaceAfter, true );
      pCell->ExtraSpaceGet( nExtraSpaceBefore, false );
      ASSERT( nItemExtent >= 0 );
      ASSERT( nExtraSpaceAfter >= 0 );
      ASSERT( nExtraSpaceBefore >= 0 );
      if( p_nExtraSpaceBefore != NULL )
            (*p_nExtraSpaceBefore) = nExtraSpaceBefore;
      if( p_nExtraSpaceAfter != NULL )
            (*p_nExtraSpaceAfter) = nExtraSpaceAfter;
      return (nItemExtent+nExtraSpaceAfter+nExtraSpaceBefore);
}