I am fighting a bit with gui and (based on an example) I can have TGListBox with a button and on the button press I can read what is selected in the list.
But I would love to connect the listbox to some slot and react on a doublecklick in the listbox. Is it possible?
Please find attached the example $ROOTSYS/tutorials/gui/listBox.C slightly modified to work in a way described by you, but based on a single mouse click. If you have a single list box in your application you may not need to connect to the signal Selected(Int_t widgetId, Int_t id), which gives you information about widget Id and the selected entry from it. In the provided example I made a connection to the Selected(Int_t id), which gives the selected entry id.
In addition, the lineprintf("HandleButton2: %d\n", 0); from your example above will print the selected entry if you replace 0 by i:printf("HandleButton2: %d\n", i); Cheers, Ilka listBox.C (3.52 KB)