[ROOT] Dynamically adding and removing TGButtons from TGComposite frames

From: Mark Thomson (thomson@hep.phy.cam.ac.uk)
Date: Mon May 21 2001 - 11:22:16 MEST


Dear Rooters,

I have two TGComposite frames containing TGTextButtons. I wish to be 
able to move buttons from one frame to the other while the window remains
open. To do this I delete and then recreate the button. This works apart 
from the fact that the removed button still `shows up' in the window. The
button isn't actually there - i.e. not clickable, but does still appear in
the display. If the window is then placed behind another and again 
brought to the front the erased button then disappears although the
background colour remains.   

I'd be extremely grateful for any suggestions ?

		Regards, 
                   Mark Thomson


The TGComposite frames containing the buttons are created within
a TGTransientFrame. (pEntity is an instance of the class  
RcGuiStateButton which inherits from TGTextButton)

  // Remove button from private list 
  inGlobalStateButtonList->RemoveStateButton(pEntity);
  // Remove button from TGComposite Frame inStateButtonFrame
  inStateButtonFrame->RemoveFrame(pEntity);
  delete pEntity;
  // Remove button from TGComposite Frame inStateButtonFrame
  inStateButtonFrame->MapSubwindows();
  inStateButtonFrame->Layout();

  // Create new button and add it to TGComposite Frame outStateButtonFrame
  pEntity = new RcGuiStateButton(outStateButtonFrame,theButtonPalette,daqID);
  outStateButtonFrame->AddFrame(pEntity,fXLayout); 
  pEntity->Associate(this);
  // Remove button from private list 
  outGlobalStateButtonList->AddStateButton(pEntity);
  // Remove button from TGComposite Frame inStateButtonFrame
  outStateButtonFrame->MapSubwindows();
  outStateButtonFrame->Layout();



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:46 MET