Simulated Mouse Click

Why doesn’t this work?

The idea is to simulate a mouse click in a TableListBox row. The cell in question does not contain a component.

void PlaylistComponent::actionListenerCallback(const String& message)
{
  auto mms = Desktop::getInstance().getMainMouseSource();
  ModifierKeys modKeys = ModifierKeys::getCurrentModifiersRealtime();
 const auto& rect = tableComponent.getCellPosition ( 5, message.getIntValue(), true);
 Point<int> pt = rect.getCentre ();
 float x = static_cast<float>(pt.getX());
 float y = static_cast<float>(pt.getY());
 Point<float> pnt{x,y};

MouseEvent me(mms, pnt, modKeys,1, 0, 0, 0, 0,
                  tcPtr,tcPtr,
                  Time::getCurrentTime(), pnt, Time::getCurrentTime(), 2, false);
  
 mouseDoubleClick(me);
}

The code compiles. mms is the MouseInputSource, pnt is a point in the centre of the cell, tcPtr is a pointer to the TableListBox component, 2 is for a double click.

I understand TableListBox inherits a MouseListener, which is what I have been counting on.

The row should highlight in orange, via paintRowBackground(), but doesn’t. (It does highlight with a regular manual mouseclick). I have also tested this code with mouseDown/mouseUp (one click only).

This approach crashes when I go to play the audio:

tableComponent.listBoxItemClicked(message.getIntValue(), me);

Your thoughts would be appreciated.