# Make visble a TableListBox

**URL:** <https://forum.juce.com/t/make-visble-a-tablelistbox/3524>\
**Category:** General JUCE discussion\
**Created:** [January 13, 2009, 12:07pm UTC](https://forum.juce.com/t/make-visble-a-tablelistbox/3524 "2009-01-13T12:07:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aleix](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@aleix](https://forum.juce.com/u/aleix)\
**Post date:** [January 13, 2009, 12:07pm UTC](https://forum.juce.com/t/make-visble-a-tablelistbox/3524/1 "2009-01-13T12:07:35Z")

</div>

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  
{  
public:

CustomGridModel(void){}  
~CustomGridModel(void){}

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

```

};[/code]

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

```auto

```

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.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 13, 2009, 12:22pm UTC](https://forum.juce.com/t/make-visble-a-tablelistbox/3524/2 "2009-01-13T12:22:00Z")

</div>

Did you give the table a size and position?

---

<div class="post-metadata">

**Author:** ![aleix](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@aleix](https://forum.juce.com/u/aleix)\
**Post date:** [January 13, 2009, 12:35pm UTC](https://forum.juce.com/t/make-visble-a-tablelistbox/3524/3 "2009-01-13T12:35:04Z")

</div>

> [@jules](#):
>
> Did you give the table a size and position?

No, that’s the problem!

Thanks!
