Get selected entry's text from ComboBox?

Hello Rooters,

I’m working on a GUI and have a question regarding the ComboBox. I hope you can help me and if you can direct me to a good example for ComboBoxes etc I would be pleased. (yes, I am reading the user guide too)

How do I get the name (text string) of the entry in the ComboBox that the user has picked?

I get the following correctly without any problems:
Int_t NbrEntries = combo->GetNumberOfEntries();
Int_t fileID = combo->GetSelected();
TGLBEntry *filePointer = combo->GetSelectedEntry();

combo is defined as: TGComboBox *combo

The fileID and NbrEntries are correct (checked with printing them out), but how do I get the text string with the file name of the selected file (with the fileID) in the comboBox?

I hope this is enough information for some help. Let me know if more info is needed. All help is appreciated - thanks! :slight_smile:

Kind regards,
Elisabeth

Hi Elisabeth,

When getting the selected entry just do:TGTextLBEntry *filePointer = (TGTextLBEntry *)combo->GetSelectedEntry(); const char *te = filePointer->GetTitle(); Cheers, Ilka

Thank you Ilka!
Now I got that working and the rest I had already implemented is now running!

Thanks for the help!