Help needed with TableListBox class?

Hi,

I am currently trying to impliment a TableListBox using a ValueTree as the underlying data.  When the GUI first loads, the ValueTree is assigned a type but has no child nodes.  Another class adds/updates nodes to the ValueTree (populated by data from incoming UDP).

My TableListBoxModel class which ownes the TableListBox recieves ValueTree::Listener callbacks in order to update the table data.  in the callback methods I use the following methods:

m_table.updateContent();
m_table.repaint();

At this point, I would expect the paintCell() method to be called in order to update the table content.  This does not seem to happen.

I have tried setting the following to force some rows to be generated with some static content when the GUI is Loaded:


int DiscoveredNodeTable::getNumRows()
{
    return 4;
}

void DiscoveredNodeTable::paintCell(Graphics& g, int rowNumber, int columnId, int width, int height, bool rowIsSelected)
{
    g.setColour(Colours::black);
    g.setFont(Font());
    String text = "moose";
    g.drawText(text, 2, 0, width - 4, height, Justification::centredLeft, true);
    g.setColour(Colours::black.withAlpha(0.2f));
    g.fillRect(width - 1, 0, 1, height);
}

The paintCell method is called when the GUI first loads and when clicking on a table row using the above test code.  For some reason, it never gets called again when the ValueTree is updated.

If anyone has any ideas as to why the updateContent() and repaint() methods are not working then, it would certainly be a great help!

Many thanks,

Chris

1 Like