Crash on TGListView::GetHeaderButons()

Hello,

I’d like to add to my list control possibility of sorting after clicking on column headers. However I am failing at a very early stage - getting the list of the header buttons with TGListView::GetHeaderButons(). It fails in both threaded and non-threaded version, I attach an example (a bit complicated but that is what I have now).
etos_dispatcher.C (853 Bytes)
triggerwindow.py (4.7 KB)

Hi,

just to say that I did not miss this topic, but I’m traveling and have trouble debugging on my (Mac) laptop. It does crash there too, though.

Cheers,
Wim

Re-hi,

the problem is that the return type of this:TGTextButton** GetHeaderButtons() { return fColHeader; }is treated as thisTGTextButton* GetHeaderButtons() { return fColHeader; }in ROOT5. It’s handled (more) properly in ROOT6. I can backport that code, but that won’t give what you want, as the returned result will be a TGTextButton** object, not a TGTextButton*[] array.

The code does not actually use the result (yet). What is the eventual code (in (pseudo-)code if possible)?

Cheers,
Wim

Something like:

buttons = container.GetHeaderButtons()

buttons[0].Connect("Clicked()", ... "Sort_by_column0")
buttons[1].Connect("Clicked()", ... "Sort_by_column1")
...

Hi,

that’s going to be hard. :frowning: The problem first of all being that a concept like “TGTextButton**” is known and handled, so somehow at run-time it must be changed to “TGTextButton*[]” instead. That’ll need some thinking.

Likely you can reconstitute this with AddressOf(), a pointer addition, and BindObject() though.

Cheers,
Wim