Re: TGTab

Laurent Aphecetche (Laurent.Aphecetche@subatech.in2p3.fr)
Thu, 03 Jun 1999 10:57:34 +0000


Rutger van der Eijk wrote:
>
> Hi Laurent,
>
> I need the same feature. 2 weeks ago I tried to implement TGTab::RemoveTab
> myself but failed (complicated isue and lake of time at the moment) I
> think I was rather close though.
>
> I asked Fons to solve this but it seems he's rather short on time at the
> moment. In the meanwhile maybe you could try yourself. Down here my
> attempt: (sorry for the Dutch)
>

Hi Rutger,

Thanks for your help.
I modified your proposed code. It fits my uses, but could you test it
also ?

//___________________________________________________________________________
void TGTab::RemoveTab(Int_t tabIndex)
{
// Remove container and tabtab of tab with index tabIndex.
// Does NOT remove the container contents!

if (tabIndex < 0) return;

TGFrameElement *elTab, *elCont ;
Int_t count = 0 ;

TIter next(fList) ;
next() ; // skip first container

while ((elTab = (TGFrameElement *) next())!=0) {
elCont = (TGFrameElement *) next();
if (count == tabIndex) {
elTab->fFrame->UnmapWindow() ;
elCont->fFrame->UnmapWindow() ;
RemoveFrame(elTab->fFrame); // takes care of deleting
elTab->fFrame
RemoveFrame(elCont->fFrame);
if (tabIndex == fCurrent) {
// we should select another tabtab only if the current is the
one we remove
SetTab(0) ;
}
break;
}
count++;
}
}

-- 
APHECETCHE Laurent (mailto:Laurent.Aphecetche@subatech.in2p3.fr)       
SUBATECH-Ecole des Mines de Nantes-4 rue Alfred Kastler-44070 NANTES
cedex 03
TEL (+33/0) 2 51 85 84 17 - FAX (+33/0) 2 51 85 84 24
WWW: http://www-subatech.in2p3.fr/~photons