Hi Mark, you have to explicitely destroy the pEntity window before deleting it. If not the associated X-window lives on and is drawn as a grey blob. It probably should be called from the destructor, but for the time being it needs to be done by hand (it is called however in the TGMainFrame and TGTransientFrame dtors). So your example should look like: // Remove button from private list inGlobalStateButtonList->RemoveStateButton(pEntity); // Remove button from TGComposite Frame inStateButtonFrame inStateButtonFrame->RemoveFrame(pEntity); pEntity->DestroyWindow(); // <-- add this line delete pEntity; ... Cheers, Fons. Mark Thomson wrote: > > 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(); -- 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 : Fri Jun 08 2001 - 11:51:25 MEST