Custom designed table displayed in a TGCanvas

Dear Rooters, I am making a custom defined table and displaying it in a TGCanvas as I need the vertical scrollbar
provided by this class to scroll down a large table.
When the table is small the code works fine, but I need a large table to display the memory
contents of 65536 memory locations , so I need 65536 rows.
But this code starts giving problems by the time rows exceeds 1636 . :^o
If we put rows = 2000 then the code displays rows till 1636 and the rest disappears.
Also a white canvas area is seen below the last row !!! #-o
And the last row somehow pops up on top of the first row !!! #-o
Maybe this has got to do with some frame size limit being exceeded or some limit on some internal variable.
or some limit on the number of child widgets the parent frame can hold.
Help greatly appreciated. I am attaching a sample ROOT code to show the problem.
I hope this code is also useful to anybody who wants to build a table in ROOT.
The code is incomplete in that -pressing the buttons there is no action as the code is yet to be completed.
table02.cpp (13.3 KB)

[quote=“Abyroot2014”]Dear Rooters, I am making a custom defined table and displaying it in a TGCanvas as I need the vertical scrollbar
provided by this class to scroll down a large table.
When the table is small the code works fine, but I need a large table to display the memory
contents of 65536 memory locations , so I need 65536 rows.
But this code starts giving problems by the time rows exceeds 1636 . :^o
If we put rows = 2000 then the code displays rows till 1636 and the rest disappears.
Also a white canvas area is seen below the last row !!! #-o
And the last row somehow pops up on top of the first row !!! #-o
Maybe this has got to do with some frame size limit being exceeded or some limit on some internal variable.
or some limit on the number of child widgets the parent frame can hold.
Help greatly appreciated. I am attaching a sample ROOT code to show the problem.
I hope this code is also useful to anybody who wants to build a table in ROOT.
The code is incomplete in that -pressing the buttons there is no action as the code is yet to be completed.
[/quote]

  1. You have to mention what version of ROOT on what platform you’re trying to use.
  2. For me - your code, however terrible the idea with millions of even hundreds of thousands of windows is, works (I tried only with 10000 rows, but it works, see the screenshot attached), but I’m pretty sure there is no guarantee any particular window manager/X11 implementation must support 65K x N windows.
  3. You have to … invent something else, optimizing and re-using rows while scrolling, that’s actually what all more or less modern GUI is doing (like ‘infinite’ tables in iOS apps, etc.)

Hi, My Linux CentOS version is as follows:

[admin@localhost ~]$ cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m

[admin@localhost ~] arch i686 [admin@localhost ~] uname -r -v -p
2.6.32-358.23.2.el6.i686 #1 SMP Wed Oct 16 17:21:31 UTC 2013 i686

Root version
ver 5.34/10 29 August 2013

Yesterday I updated my ROOT pkg to 5.34/24
and again I executed the code, now the table goes upto 1672, then a white canvas appears,
I agree my code is terrible as it is generating lots of sub-windows within a window.
I will get started to generate a table with a small set of rows which can be displayed on the screen,
loading data when the scroll button is pressed.
Thanks for showing me the right direction. =D> :smiley: :smiley: :smiley:
Cheers, Abraham Thomas V.

[quote=“Abyroot2014”]I will get started to generate a table with a small set of rows which can be displayed on the screen,
loading data when the scroll button is pressed.
Thanks for showing me the right direction. =D> :smiley: :smiley: :smiley:
Cheers, Abraham Thomas V.[/quote]

The trick is not in the ‘lazy’ data loading, but in reusing windows: you have a set of visible cells (let’s say, ~20-30 rows) + several rows below and above the current ‘viewport’ (again, ~30-40 rows above and below);
now, while scrolling, some rows will leave the viewport and become invisible, at some point, you’ll have something like 60 invisible rows on top of visible (40 initial + 20 new) and you take, say, 40 of the them and change the geometry of these (now) invisible windows, moving them below the current viewport, resetting also their contents and making them ready to show up.

That’s also quite an ugly solution, since you still have quite a lot of windows, but at least it can work.
Otherwise, have a look at, for example, $ROOTSYS/tutorials/gui/gtreeTableTest.C, also AFAIK ROOT has something like TGHtml widget that can contain a table.

Ultimate table making for Rooters…
kindly refer to attached files: dl.cpp and dl.h.
This file attached contains code to make a 200 row table with 3 columns with
26 rows of the table being displayed at any time,
with the top row being the column titles.
In the constructor of the class, data to be displayed in the table is written to
the data file. In the load_data() function data for the table is read from the table data file
and populated in the tables.
This table data file can be updated using a function at any time or on pressing the ‘Refresh’
button. Though this is not implemented here its code can be generated from the code given
in the constructor to fill the table data file.
Here a fixed number of TGTextEntry and TGNumberEntryField are generated and their data is only
changed when the scroll down/up button is pressed or the Pagedown or Pageup button is pressed.
There is also a numberEntry box where we can enter the row number from which the table is to be
displayed.
So we are only creating a fixed number of windows and subwindows and we are re-using these sub-windows.
The code has to check for the value of list_no == 0 for table number zero and == 1 for table number one.
Two seperate tables are generated with the same class.
The attached code is part of my standalone x-window application with dictionary being generated
so that TIMER signals can be used in the code. Code creating this table display class in the main program
is as follows:

case SDSP0 :
cout << “Menu item -Advanced-Show DSP Memory Block 0” << “\n” ;
if ( dsplist[0] == 0 ) {
dsplist0 = new Dsplist (fClient->GetRoot (),1400,800,0) ;
}
break;
case SDSP1 :
cout << “Menu item -Advanced-Show DSP Memory Block 1” << “\n” ;
if ( dsplist[1] == 0 ) {
dsplist1 = new Dsplist (fClient->GetRoot (),1400,800,1) ;
}
break;


Hope this code is of great help to Rooters who are looking at the forum for help in constructing
their tables. Cheers, enjoy…:slight_smile: :smiley: :smiley: :smiley: :smiley: :smiley: :smiley:
:slight_smile::-):-):-):-):-):-):-):-):-):-):-):-):slight_smile: :smiley: :smiley: :smiley: :smiley: :smiley: :smiley: :smiley:
Kindly leave a comment here if you found this code to be of help to you in your coding work.
Thanks. Abraham.T.V.
dl.h (3.9 KB)

attaching the file dl.cpp
dl.cpp (32.6 KB)

May be you should do a proper user contribution ?
here: root.cern.ch/phpBB3/viewforum.php?f=22