Make visble a TableListBox


Hi, I’m a newbie. I looking for a simple TableListBox. I tried using a code from “Table using for dummies” which is quite clear. In a Auxiliar.h file I define the class:

[code]class CustomGridModel : public TableListBoxModel


int getNumRows(void){
return 2;

void paintRowBackground (Graphics& g, int rowNumber, int width, int height, bool rowIsSelected){
if (rowIsSelected) g.fillAll (Colours::yellow);
else g.fillAll (Colours::lightgrey);

virtual void paintCell (Graphics& g, int rowNumber, int columnId, int width, int height, bool rowIsSelected){
	g.setColour (Colours::black); 
	Font font = 12.0f; 
	g.setFont (font); 

	String text; 
	if (columnId == 1){ 
		text= String(rowNumber + 1); 

	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); 


Then in an empty (no buttons, etc.) NewJucerComponent.h I include:

CustomGridModel *gridModel; TableListBox *table;

And in the contructor of NewJucerComponent in the NewJucerComponent.cpp file I write:

gridModel = new CustomGridModel() ; table = new TableListBox (T("TableName"),gridModel); addAndMakeVisible (table);

There is no compiling errors. However, when I execute the program I just only see an empty window. Maybe the problem is that this table has no data. I tried including

in the contructor, and I expected to see at least a header. But I still can’t see the table.

I’d thank a lot if someone tells me how to do it.


Did you give the table a size and position?


No, that’s the problem!