Re: TGMatrixLayout

From: Otto Schaile (Otto.Schaile@Physik.uni-muenchen.de)
Date: Sat Jul 04 1998 - 17:52:26 MEST


Otto Schaile wrote:
> 
> Hello Rooters,
> is there (i.e. has somebody) an example how to use the TGMatrixLayout
> manager?

Below you find a simple example (not very useful as it is, work it out):

class MyTable : public TGMainFrame {

private:
   TGTextEntry        *fTEItem[12];
...

MyTable::MyTable(const TGWindow *p, UInt_t w, UInt_t h)
             : TGMainFrame(p, w, h){
   Int_t ncols = 3, nrows = 0;
   fLMMatrix = new TGMatrixLayout(this, nrows, ncols);
   this->SetLayoutManager(fLMMatrix);
   fLO1 = new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2);
   char text[10];
   for(Int_t i=0; i < 12; i++){
      fTEItem[i] = new TGTextEntry
                  (this, fTBItem[i] = new TGTextBuffer(100));
      sprintf(text,"Entry %i", i+1);
      fTBItem[i]->AddText(0,text);
      fTEItem[i]->Resize(120, fTEItem[i]->GetDefaultHeight());
      this->AddFrame(fTEItem[i], fLO1);
   }

   SetWindowName("A Table of Strings");
   MapSubwindows();
   Resize(GetDefaultSize());
   MapWindow();
}


----------------------------------------------------------------------------
Otto Schaile                    Sektion Physik der LMU Muenchen
Phone: (+49 89)289 14070        Am Coulombwall 1, D-85748 Garching, Germany
FAX:   (+49 89)289 14072        EMail: Otto.Schaile@Physik.Uni-Muenchen.DE



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET