Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Report control ExpandAll is not working
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Report control ExpandAll is not working

 Post Reply Post Reply
Author
Message
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Topic: Report control ExpandAll is not working
    Posted: 18 February 2009 at 3:50pm
Hello,

It seems that ExpandAll() in report control only expands the first level in the tree, but not the rest.

Also, is it possible to somehow go through all the rows and their children without actually expanding them first? I could use GetChilds(), but maybe there's a non-recursive way to access a flat row list?

Thanks,

   Dennis

// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2009 at 11:57pm
Can't confirm - Looks like it works properly.
 
Check ReportSample - PropertesTest and modify function -

int CPropertiesView::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

..............

m_wndReport.ExpandAll();

return 0;

}

Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2009 at 12:47am
Ok, I wasn't counting the "root" level as one, so in reality it means that only the root and first level are expanded.

In the PropertiesTest, add the following near the end of the OnCreate()

    CXTPReportRecord* pRecordSecondLevel = pRecordPaintManager->GetChilds()->Add(
        new CRecordPropertyBool(ID_PROPERTY_FLATHEADER, _T("Flat Header"), pTargetReport->GetPaintManager()->GetColumnStyle() == xtpReportColumnFlat));

    pRecordSecondLevel->GetChilds()->Add(
        new CRecordPropertyBool(ID_PROPERTY_HIDESELECTION, _T("Hide Selection"), pTargetReport->GetPaintManager()->m_bHideSelection));

    pRecordSecondLevel->GetChilds()->Add(
        new CRecordPropertyInt(ID_PROPERTY_TREEINDENT, _T("Tree Indent"), pTargetReport->GetPaintManager()->m_nTreeIndent));



and then do ExpandAll() - you'll see that "Flat Header" is not expanded.
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2009 at 1:37am
You right. There is no traverse across all tree - only care abour 2 levels - parent and childs.
Question - do we need here proper functionality or this is just catch a bug but no business model beside?
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2009 at 1:42am
Personally, when I see "ExpandAll" I expect exactly that :) Since I need this functionality quite urgently (within a week), I'll write a function to do this myself, but I think it would be good if CJ had that working. Maybe with a ExpandAll(bool bReallyExpandAll = false) sort of way ;)

Also, it would be great if filtering worked on all levels, even if they are not expanded (that's the primary reason I need the ExpandAll - so that when someone tries to search for something, I'll have to expand all entries, otherwise they won't be traversed for searching/filtering).
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2009 at 8:51pm
this version of ExpandAll covered your case properly - now we need to extend it to common case (using recursive function or while(...)  loop...)

void CXTPReportControl::ExpandAll()

{

BeginUpdate();

for (int i = m_pRows->GetCount() - 1; i >= 0; i--)

{

CXTPReportRow* pRow = m_pRows->GetAt(i);

if (pRow)

pRow->SetExpanded(TRUE);

}

EndUpdate();

EnsureVisible(GetFocusedRow());

BeginUpdate();

for (int i = m_pRows->GetCount() - 1; i >= 0; i--)

{

CXTPReportRow* pRow = m_pRows->GetAt(i);

if (pRow)

{

CXTPReportRows* pChildRows = pRow->GetChilds();

if (pChildRows)

{

for (int j = pChildRows->GetCount() - 1; j >= 0; j--)

{

CXTPReportRow* pChildRow = pChildRows->GetAt(j);

if (pChildRow)

{

pChildRow->SetExpanded(TRUE);

}

}

}

}

}

EndUpdate();

EnsureVisible(GetFocusedRow());

}

Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Posted: 26 February 2009 at 3:06am
Thank you - I've created my own version of the Expand All, but I'll try yours as well. Do you think it'll make it into the next update?
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2009 at 12:54am
You can try to test https://forum.codejock.com/uploads/DemoVersion/ReportSampleSatic.rar
where Properties form have right button click handler to add childs to row where you click. There are two button on top "A" and "a".
"A" doing recursive ExpandAll, "a" - non-recursive. Adding new childs to this resizable form you can construct very complicated tree structure and after test ExpandAll in my code and also using your one - are you supported any number of tree structure levels?
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2009 at 9:06am
Strange, I wasn't notified of your reply, so I didn't see it till today...

I'll try the sample a bit later, I've got things working at the moment, but not very efficiently and filtering still doesn't work on collapsed items. In the program, the tree structure is unlimited.

Thanks!
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
apautrot View Drop Down
Groupie
Groupie
Avatar

Joined: 16 April 2009
Location: France
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote apautrot Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 4:02am
I tried the new ExpandAll method you gave here as a replacement, but I have a buggy behaviour with it. I did my own ExpandRows which works like this :


void ExpandRows ( CXTPReportRows* pRows )
{
     // for each row
     unsigned int uiRowCount = pRows -> GetCount();
     for ( unsigned int ui = 0; ui < uiRowCount; ui++ )
     {
          // get
          CXTPReportRow* pRow = pRows -> GetAt ( ui );

          // expand
          if ( ! pRow -> IsExpanded() )
          {
               pRow -> SetExpanded( TRUE );
          }

          // process recursively
          ExpandRows ( pRow -> GetChilds() );
     }
}


But this give me half my tree expanded. If I execute this method twice, I have more nodes expanded. The more I execute the method, the more expanding I get. I suspect the CXTPReportControl::_DoExpand method to be buggy, something to be linked with an item count or something like that. It is like the more rows we have in the report, the more expand actions are done, like if having 10 visible rows in report will allow less expand done than having 20 rows visible in report.

Did you get it ?

I hope you will quicly find the problem and offer a solution, it is blocking for me and I sadly need to resolve this issue.

EDIT : using your function I even have an assertion ASSERT(pRow->m_bVisible) in the method CXTPReportControl::RefreshIndexes. The rows are displayed in a buggy order, child rows being displayed at wrong index. Please fix it as quickly as possible as it is really really blocking for our software release.

EDIT : here is a way to reproduce it, simply create a tree like this (letters are order of creation of records, I don't know if it counts):
A
C
    D
      E
B
Populate, display control and try to expand with the mouse all the nodes, you might have this :
      E
A
C
    D
      E
B
Clicking on expand plus will make it asserts.

I'm using version 12.0.0

Thank you.

Alexis.


Win 7 x64
VS 2008
CJ 15.13

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 3:07pm
Don't use your own function if there is core function which now doing the job.
If you want to expand all items in full tree - you should start from the top.
If you need fresh source - open issue and if if have valid license for 2009 - I will attach you fresh source or ActiveX - depends of your purchase.
I am not going to fix smth in old version - this is obvious not logical - we are moving only forward - not back!
 
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 5:02pm
Originally posted by mdoubson mdoubson wrote:

You can try to test https://forum.codejock.com/uploads/DemoVersion/ReportSampleSatic.rar
where Properties form have right button click handler to add childs to row where you click. There are two button on top "A" and "a".
"A" doing recursive ExpandAll, "a" - non-recursive. Adding new childs to this resizable form you can construct very complicated tree structure and after test ExpandAll in my code and also using your one - are you supported any number of tree structure levels?

Ok, the sample seems to work ok - is it using the code snippet above or something else?
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 5:05pm
Of course not - this snippet is some client code (may be even for special case!?) - but in the sample you are running my code - a part of current source
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 5:13pm
Originally posted by mdoubson mdoubson wrote:

Of course not - this snippet is some client code (may be even for special case!?) - but in the sample you are running my code - a part of current source

Ok, so I assume it'll work in the next update then, right? I can live with what I have written myself for the time being, till CJ is updated and I can use internal functionality better.
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 5:37pm
Sure - up to you - if you want pre-release to use - you can. I published the exe-sample to give people try on any tree stucture they can make
Back to Top
apautrot View Drop Down
Groupie
Groupie
Avatar

Joined: 16 April 2009
Location: France
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote apautrot Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2009 at 10:45am
Originally posted by mdoubson mdoubson wrote:

Don't use your own function if there is core function which now doing the job.
If you want to expand all items in full tree - you should start from the top.


I tried to use my own function because the function ExpandAll is the version 12.0.0 have bugs. I 'm obvisouly not pleased to reinvent the wheel and loose my time trying to fix 3rd party code.

Originally posted by mdoubson mdoubson wrote:

If you need fresh source - open issue and if if have valid license for 2009 - I will attach you fresh source or ActiveX - depends of your purchase.
I am not going to fix smth in old version - this is obvious not logical - we are moving only forward - not back!


I guess my office have no other choice than buying the latest upgrade.


Win 7 x64
VS 2008
CJ 15.13

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2009 at 3:53pm
It make sense as there are now a lot of new features, fixes, support and so on...
Back to Top
apautrot View Drop Down
Groupie
Groupie
Avatar

Joined: 16 April 2009
Location: France
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote apautrot Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2009 at 10:18am
My office bought the latest version (13.0.0) and I still have the same bug with the ExpandAll function code you provided above in this thread.

The ExpandAll provided with the 13.0.0 obviously do not work properly, code provided here has a bug, but my ExpandRows function that I provided above now do the job, use it by doing ExpandRows ( pReportControl->GetRows() ) and voila. So I will use my own function rather than your core function that do not do the job.

I also discovered another bug while playing with the ReportAddRecordEx sample. I'm doing a new discussion thread for this one.


Win 7 x64
VS 2008
CJ 15.13

Back to Top
apautrot View Drop Down
Groupie
Groupie
Avatar

Joined: 16 April 2009
Location: France
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote apautrot Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2009 at 11:33am
Ok I have a new clue for you, it also bugs with my function ExpandRows when using BeginUpdate/EndUpdate before and after the call.


Win 7 x64
VS 2008
CJ 15.13

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2009 at 12:29pm
I know that 13.0 did not fix this problem - only 13.1 - this is why I asked forum to test static app based on new code
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.