listbox using connectEx signal method

Started by starkhorn, 16 October 2015, 02:53:15

starkhorn

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.

Code (cpp) Select


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



it is called using the below call

Code (cpp) Select

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

texus

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.

starkhorn

Right again Texus, I thought I was adding the second parameter in the addItem but nope I was not. Thanks again.