This TableTest class is a simple example of how to use a TGTable with a TTreeTableInterface.
TableTest inherits from TGMainFrame to create a top level frame to embed the TGTable in. First, the staff.root file is opened to obtain a tree. This tree also contains strings as data. Then a TTreeTableInterface is created using this tree. A table is then created using the interface. 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 TTreeTableInterface and TGTable, see their documentation.
#include <iostream>
private:
public:
} ;
private:
public:
void DoExit() ;
TGTable *GetTable() {
return fTable; }
};
fTable(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;
}
SetWindowName("Tree Table Test") ;
Resize(GetDefaultWidth()+20, 600) ;
MapWindow() ;
} ;
TableTest::~TableTest()
{
delete fInterface;
fFile->Close();
Cleanup() ;
}
void TableTest::DoExit()
{
DeleteWindow();
}
}
#define ClassDefOverride(name, id)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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.
Create an array to hold a bunch of numbers.
ROOT GUI Window base class.
const char * Data() const
TTreeTableInterface is used to interface to data that is stored in a TTree.
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 staffTableTest.C.