Problem with TGListBox


I’ve uploaded a short macro reproducing a problem I have with TGListBox. The macro creates a gui (which I initially built using TGuiBuilder). It has a button and a TGListBox. Clicking the button calls a function which fills the TGListBox using the AddEntry function. However, the text written to the TGListBox seems to be malformed. The entries seem to overwrite each other.

I am using root version 5.26/00 with gcc version 4.2.1 (Apple Inc. build 5646) (dot 1) on OS X 10.6.2

many thanks
testListBox.C (3.86 KB)


You have to call Layout() on your TGListBox. Just add:

at the end of your filling method.
For info, this is not automatic, since calling Layout() each time may be very expansive when filling a TGListBox with thousands of entries…

Cheers, Bertrand.

Thanks Bertrand - that worked perfectly.

I had that problem before and I figure out the layout() function…

Is it possible to request to add this extra information in the ROOT documentation for the TGListBox? It will make life easier for users using this object for the first time :slight_smile: