Removing objects from TGGroupFrame (root 6.08.00)

Hi

In my root code I create a group frame with several lines of number entries:

MyService = new TGGroupFrame(controls,"Service dates  Start/End            day  | month   |  hour", kVerticalFrame);
ServiceEndHour[ServiceN]=new TGNumberEntry(MyService, 0.0101, 2, 2,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax,1,31);
MyService->AddFrame(MyService,new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0));

and so on…
At a certain point I need to update this list and therefore have to delete it.
I use:

MyService->RemoveAll();

Then I re-add all the objects I need. Unfortunately, I get a layout as shown in the attachement. There seems to be a line left that should be deleted (the last one that appears only overlapped by the group frame.
I tried to add this, too:

MyService->MapSubwindows();
	MyService->Resize();
	MyService->MapWindow();


	fMain->MapSubwindows();
	fMain->Resize();
	fMain->MapWindow();

Same result.

How can I clean up the frame completely?

Cheers,
delos

Hi,

The first thing I see is that this line looks wrong:

Shouldn’t it be something like:MyService->AddFrame(ServiceEndHour[ServiceN],new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0));instead?

Cheers, Bertrand.

Hi bellenot

Sure, you are right. I didn’t copy it correctly from my script.
In fact it is another TGhorizontalFrame I ad which contains all the textentries:

L[ServiceN]=new TGHorizontalFrame(MyService);
ServiceStartDay[ServiceN]=new TGNumberEntry(L[ServiceN], 0.0101, 2, 2,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax,1,31);
L[ServiceN]->AddFrame(ServiceStartDay[ServiceN], new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 0));
...
MyService->AddFrame(L[ServiceN],new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0));

The I remove this array of TGhorizontalFrame *L[n]. with MyService->RemoveAll();

They are gone but one always stays left covering the lower border of the groupframe.

Cheers,
delos

Hi delos,

Could you post a running macro showing the issue? So we are sure there is no typo :wink:, and that will also probably save some of our time…

Cheers, Bertrand.

Hi bellenot

It’s 2050 lines of code plus the header file. Unfortunately containing some stuff my institute probably doesn’t want to be published. I could send you a pm though.

Cheers,
delos

Hi delos,

No problem, you can send it to bertrand.bellenot@cern.ch

Cheers, Bertrand.