Print Page | Close Window

[SOLVED] Collapsing Group Programmatically Crashes

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=22510
Printed Date: 27 November 2024 at 1:27am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] Collapsing Group Programmatically Crashes
Posted By: Peter Bragg
Subject: [SOLVED] Collapsing Group Programmatically Crashes
Date Posted: 14 January 2015 at 11:34am
Are there any known issues with the Com ActiveX ReportControl version 16.3.1 and programmatically collapsing groups? Or rather, groups with Records that themselves have children?

I am using v16.3.1 with DataFlex and the control keeps causing my application to crash. The following is test code but demonstrates the problem:

Procedure OnClick
    Variant vRow
    Handle  hoRow hoGroup
    Boolean bIsGroup bExpanded
    
    Get ComFocusedRow of oReportControl to vRow
    Get Create (RefClass(cCJReportRow)) to hoRow
    Set pvComObject of hoRow to vRow
    Get ComGroupRow of hoRow to bIsGroup
    If (bIsGroup) Begin
        Get Create (RefClass(cCJReportGroupRow)) to hoGroup
        Set pvComObject of hoGroup to vRow
        Get ComExpanded of hoGroup to bExpanded
        Set ComExpanded of hoGroup to (not(bExpanded))
        Send Destroy of hoGroup
    End
    Send Destroy of hoRow
End_Procedure

(This is test code by the way, so I know that the FocusedRow will always return a value)

The test code simply expands or collapses a group row, depending on its current state (if collapsed it will expand it and vice versa)

So, if the group row is collapsed, no problem, it gets expanded. If it is expanded though it then depends on the rows. If the rows have no child rows then the group collapses with no issues. But if just one of the rows within the group has child rows of its own (the first column has the TreeColumn property set to True) then the application crashes.

I can see from the release notes for 16.2.5 for the ReportControl that one of the fixes was "Fixed crash when manually expanding/collapsing a row via code" - which is what caused me to wonder if there was still an issue in this area?





Replies:
Posted By: olebed
Date Posted: 23 April 2015 at 7:02am
fixed in revision 16822  (January 20, 2015) due to support ticket 33444  "Report Control - Expand property" (crash in ActiveX on multilevel nesting rows).

in file XTPReportSection.cpp
int CXTPReportSection::_DoCollapse(CXTPReportRow *pRow)
{
int nIndex = pRow->GetIndex() + 1;
if (nIndex == 0) // pRow->GetIndex() == -1
return 0; // pRow already collapsed
...
}
...
void CXTPReportSection::RefreshIndexes(int nIndexStart)
{
int nRowCount = m_pRows->GetCount();
nIndexStart = nIndexStart < 0 ? 0 : nIndexStart;
...
}
 
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net