TableListBox is killing me

I really struggle to understand and use TableListBox. When I copy the tutorial it works, but when I try to create a simple project from scratch I do not get it to work. I have found an instruction that describes step by step how to do, but I encounter problems.
The steps I take:

  1. I create a project (GUI application) in Projucer
    Adds a new Component class “PlaylistComponent” (split between CPP and header)
  2. Adds the new class to the MainComponent and makes it visible. So far so good.
  3. Adds a TableListbox Component to the PlaylistComponent, makes it visible and adds some columns.
  4. Now the problem starts. The instructions says:
We are going to implement these on the PlaylistComponent class. In Playlist-
Component.h, update the inheritance relationship:
class PlaylistComponent : public Component,public TableListBoxModel

When I do this I get the following errors:

Severity	Code	Description	Project	File	Line	Suppression State
Error (active)	E0322	object of abstract class type "PlaylistComponent" is not allowed:	TableListBoxAttempt_App	E:\GitHub\JUCE\My projects\TableListBoxAttempt\Source\MainComponent.h	25	

,

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2259	'PlaylistComponent': cannot instantiate abstract class (compiling source file ..\..\Source\MainComponent.cpp)	TableListBoxAttempt_App	E:\GitHub\JUCE\My projects\TableListBoxAttempt\Source\MainComponent.h	25	

and

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2259	'PlaylistComponent': cannot instantiate abstract class (compiling source file ..\..\Source\Main.cpp)	TableListBoxAttempt_App	E:\GitHub\JUCE\My projects\TableListBoxAttempt\Source\MainComponent.h	25	

Since I’m a beginner at this, I have no clue what is wrong.

Here is the code: https://www.dropbox.com/s/lqncjw0qeepjm8z/TableListBoxAttempt.zip?dl=0

First, you need this:

class PlaylistComponent  : public juce::Component,

Instead of that:

class PlaylistComponent  : public Component,

Then,

your PlaylistComponent inherits from TableListBoxModel that is an abstract class.
You don’t implement the pure virtual methods thus it can not work.

I didn’t go further to see if more errors remains.

Thank you for trying to help, I’ve tried that. Unfortunately, that makes no difference at all :cry:

EDIT:
Sorry, I had to do a couple of more steps. Then it worked.
I needed to register the PlaylistComponent with the TableListBox as a TableListBoxModel. (tableComponent.setModel(this); in the .cpp file).
:flushed:
As mentioned, I am a beginner.

You have implemented…

PlaylistComponent::getNumRows
PlaylistComponent::paintRowBackground
PlaylistComponent::paintCell

… and it doesn’t work?

See my edited answer above.

1 Like

TBH the TableListBox/TableListBoxModel is not very easy to understand at first.
Each time i go back to it, i have to refresh my memory a bit.

3 Likes

Hello

In the JUCE demo application (DemoRunner), you have an example called WidgetsDemo.h (in GUI). There is a panel with a TableListBox. You can use it as an example.
Hope that helps

1 Like

Thank’s to both of you for helping out.

@fbecir
Thank’s for the advice. I’ve already found that and a numerous other examples with Google. I have found that my big problem is my level of knowledge in C ++. I come from C # and have not really been aware of how big the differences are. C ++ is really difficult for me, but eventually I will get there :grinning:.