Re: TGTab

From: Valeriy Onuchin <Valeri.Onoutchine_at_cern.ch>
Date: Tue, 19 Apr 2005 09:50:07 +0200


Thomas Bretz wrote:

> Hi,
>
> is it possible to implement a Getter which returns the tab by name
> instead of number?
>
> Thomas.

Hi Thomas,
here is the code.

Regards. Valeriy

//______________________________________________________________________________
TGCompositeFrame *TGTab::GetTabContainer(const char *name) const {

   // Return the tab container of tab with string name.    // Returns 0 in case name is not found.

   TGFrameElement *el;
   TGTabElement *tab = 0;
   TGCompositeFrame *comp = 0;

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

   while ((el = (TGFrameElement *) next())) {

      el = (TGFrameElement *) next();
      comp = (TGCompositeFrame *) el->fFrame;
      next();
      tab = (TGTabElement *)el->fFrame;
      if (name == *(tab->GetText())) {
         return comp;
      }

   }

   return 0;
}

//______________________________________________________________________________
TGTabElement *TGTab::GetTabTab(const char *name) const {

   // Return the tab element of tab with string name.    // Returns 0 in case name is not found.

   TGFrameElement *el;
   TGTabElement *tab = 0;

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

   while ((el = (TGFrameElement *) next())) {

      next();
      tab = (TGTabElement *)el->fFrame;
      if (name == *(tab->GetText())) {
         return tab;
      }

   }

   return 0;
} Received on Tue Apr 19 2005 - 09:50:14 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET