This TableTest class is a simple example of how to use a TGSimpleTable that creates and owns it's own TGSimpleTableInterface.
TableTest inherits from TGMainFrame to create a top level frame to embed the TGTable in. First the data needed is created. Then the TGSimpleTable is created using this data. 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 TGSimpleTable see it's documentation.
#include <iostream>
class IDList {
private:
public:
IDList() : nID(0) {}
~IDList() {}
Int_t GetUnID(
void) {
return ++nID ; }
} ;
private:
IDList IDs ;
public:
~TableTest() override ;
void DoExit() ;
};
:
TGMainFrame(
p,
w,
h), fData(nullptr), fNDataRows(ndrows), fNDataColumns(ndcols),
fNTableRows(ntrows), fNTableColumns(ntcols), fSimpleTable(nullptr)
{
Connect("CloseWindow()", "TableTest", this, "DoExit()") ;
DontCallClose() ;
for (i = 0; i < (
Int_t)fNDataRows; i++) {
for (j = 0; j < (
Int_t)fNDataColumns; j++) {
fData[i][j] = 10 * i + j;
}
}
fSimpleTable =
new TGSimpleTable(
this, IDs.GetUnID(), fData, fNTableRows,
fNTableColumns);
SetWindowName("TGSimpleTable Test") ;
Resize(GetDefaultWidth()+20, 600) ;
MapWindow() ;
} ;
TableTest::~TableTest()
{
for (i = 0; i < fNDataRows; i++) {
delete[] fData[i];
}
delete[] fData;
Cleanup() ;
}
void TableTest::DoExit()
{
DeleteWindow();
}
TableTest *
test =
new TableTest(
nullptr, ndrows, ndcols, ntrows, ntcols, 500, 200);
}
#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
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
To provide a simple class to visualize an array of doubles, the class TGSimpleTable is provided.
ROOT GUI Window base class.
RooCmdArg Layout(double xmin, double xmax=0.99, double ymin=0.95)
- Author
- Roel Aaij 13/07/2007
Definition in file simpleTableTest.C.