Hi JUCE team. I have a quick question regarding the Components you can use inside a TableListBox.
I have a basic TableListBox with column 1 as plain text and column 2 as a ProgressBar. The ProgressBar is used to indicate progress of a file operation.
The TableListBoxModel::refreshComponentForCell looks like this:
Component* TargetComponent::refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected, Component* existingComponentToUpdate) { if (columnId == 1) { jassert(existingComponentToUpdate == nullptr); return nullptr; } if (columnId == 2) { ProgressBar* bar = static_cast<ProgressBar*>(existingComponentToUpdate); if (bar == nullptr) { bar = new ProgressBar(m_entries[rowNumber]->m_percentage); } return bar; } return nullptr; }
When the file progress of 'm_entities[0]' finishes it deletes itself from the array and calls table.updateContent(); The ProgressBar for the second file, which is now entry 0; now doesn't update it's ProgressBar anymore. It looks like the 'existingComponentToUpdate' passed into the refreshComponentForCell() is the pointer to the first entry which is now no longer there.
I am obviously doing something wrong here, but not sure what.