cellClicked not working with custom cell components

I have a TableListBox which displays custom cells. My refreshComponentForCell function is implemented as such:

Component* ATLoopsTableView::refreshComponentForCell (int rowNumber, int columnId, bool /*isRowSelected*/,
                                    Component* existingComponentToUpdate)
{
    ATLoopCell* loopCell = nullptr;
    if (existingComponentToUpdate != nullptr) {
        loopCell = static_cast<ATLoopCell*>(existingComponentToUpdate);
    } else {
        loopCell = new ATLoopCell(mLoops[rowNumber], mRemoteDataMgr, mSampleManager, mLoopPreviewView, mLevelInterface);
        
    }
    loopCell->setLoop(mRemoteDataMgr->getLoop(mLoops[rowNumber]));
    return loopCell;
}

With this in place, the cellClicked function does not get triggered when I click the cell. However, if I simply return the existingComponentToUpdate in the refreshComponentForCell function, it gets triggered correctly. How can I implement my custom components correctly as to be able to trigger the cellClicked function?

This is because the custom component will consume the mouse event so it never reaches the TableListBox and cellClicked() will not be called. Try doing setInterceptsMouseClicks (false, true) in your custom component’s constructor.