listbox using connectEx signal method
« on: 16 October 2015, 02:53:15 »
So I have visual studio 2013 express so according to the signal tutorial, I need to use the connectEX method.

So when an item is selected in a listbox, is there a way to get the itemID in the callback? I have the below simple signal function but the itemID is always empty.

void drawEngine::armyUnitListBoxSignalFunction(const tgui::Callback& callback)
        string item = callback.text;
        string itemID = callback.itemId;


it is called using the below call

        tgui::ListBox::Ptr armyUnitListBox = gui.get<tgui::ListBox>(ListBoxID, true);
        armyUnitListBox->connectEx("ItemSelected", &drawEngine::armyUnitListBoxSignalFunction, this);



  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: listbox using connectEx signal method
« Reply #1 on: 16 October 2015, 09:32:21 »
It works fine here, are you setting an id as second parameter to listBox->addItem? Because you have to give the ids yourself otherwise the id will just be empty.

Re: listbox using connectEx signal method
« Reply #2 on: 17 October 2015, 02:18:02 »
Right again Texus, I thought I was adding the second parameter in the addItem but nope I was not. Thanks again.