This TableTest class is a simple example of how to use a TGTreeTable.
TableTest inherits from TGMainFrame to create a top level frame to embed the TGTreeTable in. First, the staff.root file is opened to obtain a tree. A TGTreeTable is then created using the tree. In the end, the table is added to the TGMainFrame that is the TableTest and the necessary calls to correctly draw the window are made. For more information about the use of TGTreeTable, see it's documentation.
#include <iostream>
class IDList {
private:
public:
IDList() : nID(0) {}
~IDList() {}
Int_t GetUnID(
void) {
return ++nID ; }
};
private:
IDList fIDs;
public:
~TableTest() override ;
void DoExit() ;
};
fTreeTable(nullptr)
{
Connect("CloseWindow()", "TableTest", this, "DoExit()") ;
DontCallClose() ;
fFile =
new TFile(
"cernstaff.root");
if (!fFile || fFile->IsZombie()) {
printf("Please run <ROOT location>/tutorials/tree/cernbuild.C first.");
return;
}
TString varexp =
"px:py:pz:random:sin(px):log(px/py):log(pz)";
TString select =
"px>0 && py>0 && pz>0";
fTreeTable =
new TGTreeTable(
this, fIDs.GetUnID(), tree);
SetWindowName("TGTreeTable Test") ;
Resize(GetDefaultWidth()+20, 600) ;
MapWindow() ;
} ;
TableTest::~TableTest()
{
fFile->Close();
Cleanup() ;
}
void TableTest::DoExit()
{
DeleteWindow();
}
TableTest *test = new TableTest(nullptr, ntrows, ntcols, 500, 200);
return test->GetTable();
}
#define ClassDefOverride(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
TGTreeTable is a TGTable that owns it's own interface.
ROOT GUI Window base class.
A TTree represents a columnar dataset.
RooCmdArg Layout(double xmin, double xmax=0.99, double ymin=0.95)
- Author
- Roel Aaij 13/07/2007
Definition in file gtreeTableTest.C.