Does anyone know how to target / access a child button created in a table list box using refreshComponentForCell? I need to change the toggle state of the button in the table when something happens in the app. I’ve tried things like getting the component via row and col using getCellComponent(row, col). This returns the correct enclosing component I can show and hide, but I have no idea how to get inside that to access the toggle button and its state that is created in there. I even tried building a vector and putting all the buttons in there, but this does not work either. This is probably a dumb question, but I’m a noob, any advice really appreciated, I’m really stumped on this one.
juce::Component* Playlist::refreshComponentForCell(int rowNumber, int columnId, bool /*isRowSelected*/,
juce::Component* existingComponentToUpdate)
{
if (columnId == 4)
{
if (existingComponentToUpdate == nullptr)
{
juce::ToggleButton* btn = new juce::ToggleButton;
btn->onClick = { doStuff(); };
btn->setComponentID("test");
existingComponentToUpdate = btn;
}
return existingComponentToUpdate;
}```
Trying to access it like this (does not work):
void Playlist::DragComplete()
{
// trying to do something like this...
// table.getCellComponent(4,1)->btn.getToggleState();
// this correctly hides the button, but I need to change the toggle state
table.getCellComponent(4, 1)->setVisible(false);
}