I was doing something like this:
Code: Select all
CEGUI::ListboxItem* item = mSelectList->getFirstSelectedItem();
if(!item)
return true;
for(;item != NULL; item = mSelectList->getNextSelected(item))
{
//do something here for selected item
}
However it wasn't working as I expected. If a user had selected two rows, it was iterating through the first selected row, each item in each column in that row, but then not moving onto the next row. I looked at the source code for CEGUIMultiColumnList::getNextSelected and couldn't see what the problem might be. I'm actualling using the compiled SDK 0.4.1 but I additionally downloaded the source.
To get what I wanted I had to do this:
Code: Select all
CEGUI::ListboxItem* item = mSelectList->getFirstSelectedItem();
if(!item)
return true;
int colCount = mSelectList->getColumnCount();
int rowCount = mSelectList->getRowCount();
for(int row = 0; row < rowCount; ++row)
{
for(int col = 0; col < colCount; ++col)
{
CEGUI::MCLGridRef gridRef(row, col);
//get item by grid reference
item = mSelectList->getItemAtGridReference(gridRef);
if(item->isSelected())
{
//do something here with the selected item
break; //break out of the column loop
}
}
}
Perhaps this will help others, or you could explain what I was doing wrong.
Clay