Re: [ROOT] Closing a TGFrame.

From: Brett Viren (bv@bnl.gov)
Date: Wed Oct 17 2001 - 20:48:33 MEST


Hi again.  More info:

Here is a short example

void dorktest () 
{
    cerr << "Dork!\n";

    TGMainFrame* fFrame = new TGMainFrame(gClient->GetRoot(),500U,500U);
    TGButton* fButton = new TGTextButton(fFrame,"Die",0);
    fButton->Connect("Clicked()","TGMainFrame",fFrame,"SendCloseMessage()");
    TGLayoutHints* loh = new TGLayoutHints(kLHintsTop | kLHintsLeft);
    fFrame->AddFrame(fButton,loh);
    fFrame->Layout();
    fFrame->MapSubwindows();
    fFrame->Resize(fFrame->GetDefaultSize());
    fFrame->MapWindow();
    cerr << "Frame at: " << fFrame << endl;
}

Run it like:
root [0]  gObjectTable->SetObjectStat(true)
root [1]  gObjectTable->Print(); 
...
[ no TGMainFrame or TGButtons ... ]
root [2] .x test/dorktest.C
Dork!
Frame at: 0x86d3b78
root [3]  gObjectTable->Print(); 
...
TGMainFrame                 1          1       84            84           84
TGTextButton                1          1      144           144          144
...
[ now, click button, Frame goes away ]
root [4]  gObjectTable->Print(); 
...
TGMainFrame                 1          1       84            84           84
TGTextButton                1          1      144           144          144
...


So, what is the correct way to assure the Frame and Button get deleted?

-Brett.



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