Re: TGCompositeFrame::HideFrame() problems

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Aug 26 1999 - 16:32:06 MEST


Hi Burt,

 sorry for the delayed answer (I am still working through my backlog
after my trip).

You should call the HideFrame() only after the window has been layed out
and the subwindows have been mapped, but before mapping the main window:

   ...
   main->AddFrame(HFrame, fLayout);  main->AddFrame(HFrame2, fLayout);

   main->Resize(main->GetDefaultSize());

   main->MapSubwindows();

   main->HideFrame(HFrame2);   // now hide frame HFrame2

   main->MapWindow();
}


and typing:

   main->ShowFrame(HFrame2)

brings back the hidden frame.


Cheers, Fons.




Burt Holzman wrote:
> 
> Hello ROOTers,
> 
> Having a little trouble with TGCompositeFrame::HideFrame(); I assume
> the functionality is that it should hide subframes completely.  However,
> in this snippet of code, the hidden subframe seems to obscure ones on
> top.
> 
> Any ideas?
> 
> - B
> 
> ------------------
> 
> {
> TGLayoutHints *fLayout = new TGLayoutHints(kLHintsTop, 2, 2, 2, 2);
> 
> TGMainFrame *main = new TGMainFrame(gClient->GetRoot(), 250, 250);
> 
> TGHorizontalFrame *HFrame = new TGHorizontalFrame(main, 100, 100);
> TGHorizontalFrame *HFrame2 = new TGHorizontalFrame(main, 100, 100);
> 
> TGTextButton *button1 = new TGTextButton(HFrame, "button1", 1);
> TGTextButton *button2 = new TGTextButton(HFrame, "button2", 2);
> TGTextButton *button3 = new TGTextButton(HFrame2, "button3", 3);
> TGTextButton *button4 = new TGTextButton(HFrame2, "button4", 4);
> 
> button1->Associate(main); button2->Associate(main);
> button3->Associate(main); button4->Associate(main);
> 
> HFrame->AddFrame(button1, fLayout); HFrame->AddFrame(button2, fLayout);
> HFrame2->AddFrame(button3, fLayout); HFrame2->AddFrame(button4,
> fLayout);
> 
> main->AddFrame(HFrame, fLayout);  main->AddFrame(HFrame2, fLayout);
> 
> main->HideFrame(HFrame2);
> 
> main->Resize(main->GetDefaultSize());
> 
> main->MapSubwindows(); main->MapWindow();
> }

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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