Hi All,
I am trying to write a GUI and want to use TGListTree, but my root macro segfaults. Can anyone point out what am I doing wrong in the example below?
I am actually trying to put a browser inside a frame, if anyone could hint me how… that wuld be better.
thanks in advance,
-Aram.
//----------------------------------------------------
class TestListTree{
RQ_OBJECT(“TestListTree”)
private:
TGMainFrame* fMain;
TGHorizontalFrame* hframe;
public:
TestListTree(const TGWindow* p, UInt_t w, UInt_t h);
virtual ~TestListTree();
};
TestListTree::TestListTree(const TGWindow* p, UInt_t w, UInt_t h)
{
fMain = new TGMainFrame(p, w, h);
hframe = new TGHorizontalFrame(fMain, 800, 600);
TGListTree* listtree = new TGListTree(hframe, 200, 600, kSunkenFrame);
listtree->Associate(fMain);
gDirectory->mkdir(“new directory”);
gDirectory->cd(“new directory”);
//TH1* th = new TH1(“th”, “an empty 1d histo”, 20, 50, 100);
TGListTreeItem* item = listtree->AddItem(0,“ROOT Memory”);
listtree->OpenItem(item);
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 1, 1, 1, 1));
fMain->SetWindowName(“TListTree Test”);
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
}
TestListTree::~TestListTree()
{
fMain->Cleanup();
delete fMain;
}
void testlisttree()
{
new TestListTree(gClient->GetRoot(), 800, 600);
}
//---------------------------------------