TGHScrollBar

Hi,

I have many (> 400) user parameters that I read into an instance of the class Table inherited from the (public) class TGTransientFrame (below). As only a subset of the 400 user parameters simultaneously fit onto the screen I have been trying to add a vertical scroll bar to access (show) those “hidden” parameters. The screen shot I attach illustrates the relative futility of my attempts. Surely this is not an unusual situation, but I am unable to find a remotely similar post.

Thanks,

Steve Asztalos

Table::Table (const TGWindow * p, const TGWindow * main, int columns,
int rows, char *name, int NumModules)
{
SetCleanup (kDeepCleanup);
//Rows=rows;

numModules=NumModules;

mn_vert = new TGVerticalFrame (this, 200, 300);

//TGMainFrame *fMainFrame1101 = new TGMainFrame(0,10,10,kMainFrame | kVerticalFrame);
//fMainFrame1101->SetLayoutBroken(kTRUE);
TGVScrollBar *fVScrollBar = new TGVScrollBar(mn_vert,16,102,kVerticalFrame | kOwnBackground);
fVScrollBar->SetRange(100,20);
fVScrollBar->SetPosition(21);
mn_vert->AddFrame(fVScrollBar, new TGLayoutHints(kLHintsLeft | kLHintsTop,200,2,2,2));
fVScrollBar->MoveResize(168,128,16,102);

// mn_vert->SetMWMHints(kMWMDecorAll,
// kMWMFuncAll,
// kMWMInputModeless);
mn_vert->MapSubwindows();

mn_vert->Resize(mn_vert->GetDefaultSize());
mn_vert->MapWindow();
mn_vert->Resize(490,370);

mn = new TGHorizontalFrame (mn_vert, 200, 300);
//TGMainFrame *fMainFrame1101 = new TGMainFrame(0,10,10,kMainFrame | kVerticalFrame);
//fMainFrame1101->SetLayoutBroken(kTRUE);
TGHScrollBar *fHScrollBar = new TGHScrollBar(mn,16,102,kHorizontalFrame | kOwnBackground);
fHScrollBar->SetRange(100,20);
fHScrollBar->SetPosition(21);
mn->AddFrame(fHScrollBar, new TGLayoutHints(kLHintsLeft | kLHintsTop,200,2,2,2));
fHScrollBar->MoveResize(168,128,16,102);

mn_vert->AddFrame (mn,
new TGLayoutHints (kLHintsTop | kLHintsLeft, 0, 0, 0,
0));
AddFrame (mn_vert,
new TGLayoutHints (kLHintsTop | kLHintsLeft, 2, 2, 2, 2));

Buttons = new TGHorizontalFrame (mn_vert, 400, 300);

Column = new TGVerticalFrame *[columns];
for (int i = 0; i < columns; i++)
{
Column[i] = new TGVerticalFrame (mn, 200, 300);
mn->AddFrame (Column[i],
new TGLayoutHints (kLHintsTop | kLHintsLeft, 0, 0, 0, 0));
}



}


Hi Steve,

The best solution is to use a TGCanvas as container for your table elements. Just take a look a the simple example in attachment. If it is not what you want, or if it doesn’t help, feel free to post a running macro illustrating what you want to achieve.

Cheers, Bertrand.
test_table.C (2.47 KB)

And another (even simpler) solution could be to use a TGTable widget:

[code]void TestTable(UInt_t nrows = 10, UInt_t ncolumns = 10)
{
// Create an array to hold a bunch of numbers
Int_t i = 0, j = 0;
Double_t** data = new Double_t*[nrows];
for (i = 0; i < nrows; i++) {
data[i] = new Double_t[ncolumns];
for (j = 0; j < ncolumns; j++) {
data[i][j] = 10 * i + j;
}
}

// Create a main frame to contain the table
TGMainFrame* mainframe = new TGMainFrame(0, 400, 200);
mainframe->SetCleanup(kDeepCleanup) ;

// Create an interface
TGSimpleTableInterface *iface = new TGSimpleTableInterface(data, nrows, ncolumns);

// Create the table
TGTable *table = new TGTable(mainframe, 999, iface);

// Add the table to the main frame
mainframe->AddFrame(table, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));

//Update data
data[5][1] = 3.01;
//update the table view
table->Update();

// Layout and map the main frame
mainframe->SetWindowName(“Tree Table Test”) ;
mainframe->MapSubwindows() ;
mainframe->Layout();
mainframe->Resize() ;
mainframe->MapWindow() ;
}
[/code]
Cheers, Bertrand.