Problem with TGListBox update when hiding/showing a frame

Dear Rooters

Using the newest CVS version of root from 14 January 2005 on MacOS X,
the enclosed macro “guiTwoGroupsTest.C” shows the following problems:

1, Update problem:
Using File->Open I select a root file containing TTrees, which are
displayed in fSelTreeBox. Then I select some of the trees and add
them to fG1TreeBox by pressing the “>” button.
However, when I check TGCheckBox “Select Groups” and then uncheck
the checkbox again, then both fSelTreeBox and fG1TreeBox no longer
display the trees, both boxes appear to be empty.
Only clicking the mouse button in one of the TGListBoxes is able
to display the trees in the corresponding listbox again.
(Alternatively, switching to Tab “Test” and then back to Tab “Groups”
is also able to display the trees again.)

Is there a bug in my code or is there a problem with TGListBox?

2, Irreproducible segmentation violation:
When I add/remove selected trees repeatly by pressing alternatively
buttons “>” and “<” very often, I get sometimes (but not reproducible):
*** Break *** segmentation violation.
However, pressing alternatively “>” and “<<” did until now not
result in a similar problem.

The crash is at line 531 or 532 when I delete TList selG1.
Interestingly, I could reproduce this problem only in CINT but
never after compiling with ACLiC.
Does anyone have a hint what might be the reason?

3, Problem with show/hide frame “Group Sets”:
Although checking/unchecking TGCheckBox “Select Groups” is able
to show/hide frame “Group Sets” in the current macro, using the
same code I am not able to show the frame in my application.

This problem is a variant to my 1st problem described in my topic
“Problem hiding group frame”, see:
root.cern.ch/phpBB2/viewtopic.ph … da48ab0d42

Any solution to the problem of showing/hiding frames in deeply
nested frame hierarchies would be greatly appreciated.

Best regards
Christian
guiTwoGroupsTest.C (24.8 KB)

Hi Christian,

There were changes in TGListBox class required by the “fix 32k pixmap limitation problem for list boxes, combo boxes” as cvs log shows. Unfortunately the change below was not mention explicitly in any of the development notes too:

class TGLBContainer : public TGCompositeFrame { …

was replaced by
class TGLBContainer : public TGContainer { …

It might cause the problems if the application was created before this change.

Cheers, Ilka

Hi Christian,

I’m investigating it. Must be fixed today.
Thanks for very nice “prototype” code. I’m going to reuse it
in gui builder.

We added more “optimisation” in TGListBox code for
case of very large number of entries.

Regards. Valeriy

Hi Christian,

  1. fix must be in CVS today.

For a moment, you can call gClient->NeedRadraw(listbox->GetContainer()) on check/uncheck.

Thanks. Regards. Valeriy

Hi Christian,

After calling fFT2Grps->Show/HideFrame(fFGGrpPat); you need to force layout algorithm of the main frame; i.e. adding fMain->Layout() solves your problem (see the code below):

void XFilterFrame::DoSelectGroup(Int_t id)
{
   if(kCS) cout << "------XFilterFrame::DoSelectGroup------" << endl;

   if (id == -1) {
      TGButton *btn = (TGButton*)gTQSender;
      id = btn->WidgetId();
   }//if

//   fFT2Grps->HideFrame(fFGGrpPat);

   switch (id) {
      case C_GROUP2SET:
         if (fCheckPat->GetState() == kButtonDown) {
            fFT2Grps->ShowFrame(fFGGrpPat);
         } else {
            fFT2Grps->HideFrame(fFGGrpPat);
         }//if
   fMain->Layout();        //  <---- Add this line

//not possible to hide fFGGrpPat when:
//         fFT2Grps->MapSubwindows();  
//         fFT2Grps->Layout();
//or:
//         fFTwoGrps->MapSubwindows();
//         fFTwoGrps->Layout();
//this results in *** Break *** segmentation violation
//         fFrame->MapSubwindows();
//         fFrame->Layout();
         break;

      default:
         printf("Error: <XFilterFrame::DoSelectGroup> Unknown ID %d selected\n", id);
         break;
   }//switch
}//DoSelectGroup

Cheers, Ilka

Dear Valeriy, dear Ilka:

Thank you for your suggestions, calling both:
gClient->NeedRedraw(fListbox->GetContainer());
fMain->Layout();

did solve the problems in my GUI application.

Best regards
Christian