Home | News | Documentation | Download

TGListView signals and TGLVEntry subnames

Hello, I have two questions regarding TGListView

  1. Is there any way to get subnames of TGLVEntry? There is a method SetSubnames, but no GetSubnames or GetSubname…
  2. How should a double click on the TGListView be handled? It seems my program sees dblclick from TGLVContainer, but not from the TGListView. The sample is on the pyROOT forum: TGListView signals

Hi,

[quote=“LeWhoo”]1. Is there any way to get subnames of TGLVEntry? There is a method SetSubnames, but no GetSubnames or GetSubname…[/quote]Well, you’re right, there is no getter…[quote=“LeWhoo”]How should a double click on the TGListView be handled? It seems my program sees dblclick from TGLVContainer, but not from the TGListView.[/quote]Well, this should work, if you connect to DoubleClicked() instead of Clicked(). Which version of ROOT? Which platform? Which compiler?

Cheers, Bertrand.

[quote=“bellenot”]Hi,

Well, you’re right, there is no getter…
[/quote]

I understand that this is “lacking feature”, beacuse getter with index like GetSubname(Int_t indx) should be extremely easy to write :slight_smile:

First of all, I tried in PyROOT and Wim suggested asking here. Fedora 19, ROOT 5.34.15, python 2.7.5, g++ 4.8.2

[quote=“LeWhoo”]I understand that this is “lacking feature”, beacuse getter with index like GetSubname(Int_t indx) should be extremely easy to write [/quote]Indeed. I will add the missing methods.
And concerning signal slots, it works perfectly fine with 5-34-00-patches, and it should work with older versions as well. Just try the attached macro and let me know if it doesn’t work for you…

Cheers, Bertrand.
TestListView.C (5.33 KB)

Works. So it must be a PyROOT problem, I guess. Back to PyROOT support forum.

Btw. Scrolling a mouse wheel produces DblClick event. Not sure if it is the expected behaviour…

[quote=“LeWhoo”]Btw. Scrolling a mouse wheel produces DblClick event. Not sure if it is the expected behaviour…[/quote]Well, I don’t see this… Anyway, you can still check for the mouse button id (mouse wheel should be 4 or 5)

OK. Maybe this is this mouse somehow. But I will filter by mouse button. Here it is:

DoubleClicked(0x2f74560, btn=5)
DoubleClicked(0x2f74560, btn=5, x=797, y=378)
DoubleClicked(0x2f74560, btn=5)
DoubleClicked(0x2f74560, btn=5, x=797, y=378)
DoubleClicked(0x2f74560, btn=4)
DoubleClicked(0x2f74560, btn=4, x=797, y=378)
DoubleClicked(0x2f74560, btn=4)
DoubleClicked(0x2f74560, btn=4, x=797, y=378)

FYI, I just added the following TGListView methods in master and 5-34-00-patches:

virtual TGString **GetSubnames(); virtual TGString *GetSubname(Int_t idx);
Cheers, Bertrand.

Thanks!

OK, I solved the problem, I was associating container with the main window not the list window. Maybe you could add the example you posted to tutorials? It is not really clear how to use TGListView, since it is not well documented.

Well, we are going to review all tutorials, so maybe I will add this one (or similar) but there are several example showing signal/slots anyway, and the principle is the same for all classes…

For signals/slots yes. But not for the TGListView as a gui element. I spent some time trying to figure out how to use it and encountered lot’s of crashes before. These simple things like a need for container, need to Associate it with list, need to SetContainer for the list, etc.

OK, I will add something.

Cheers, Bertrand.