List Boxes and Models


#1

Hello

I used the Draganddropdemo to create a List Box, it displays fine. But it seems to only load the data to be displayed once when initialized. I have tried updateComponents(), but it did nothing.

Here is my Source…

#include "ListBoxPack.h"

ListBoxPack::ListBoxPack() : ListBox("ViewWindow", 0)
{
setModel(this);
}

ListBoxPack::~ListBoxPack()
{
 
}

int ListBoxPack::getNumRows()
{
    return 100;
}

void ListBoxPack::paintListBoxItem(int rowNumber,
    Graphics& g,
    int width,
    int height,
    bool rowIsSelected)
  {

    if (rowIsSelected)

	    g.fillAll(Colours::lightblue);
	    g.setColour(Colours::white);
	    g.setFont(height * 0.7f);
	    g.drawText("Successfully loads Nodes into array but doesn't display",
		    5, 0, width, height,
		    Justification::centredLeft, true);

 }


void ListBoxPack::paint(Graphics& g)
{
    g.fillAll(Colours::white.withAlpha(0.7f));
}

and the header…

#include "../JuceLibraryCode/JuceHeader.h"


class ListBoxPack : public ListBox,
				private ListBoxModel
{
public:
    ListBoxPack() ;
    ~ListBoxPack();

    int getNumRows();

    void paintListBoxItem(int rowNumber,
						Graphics& g,
						int width,
						int height,
						bool rowIsSelected);

    void paint(Graphics& g);

    String DisplayArray[100];
 private:
 };    

in the DisplayArray I have managed to load all my Strings into it. I juce can’t work out how to get them in the model.

Thanks for the support people.