Tree View


#1

I started with Jules’ demo app Tree View implementation, but I’m doing something wrong and my tree is not displaying. I also don’t understand how the xml is parsed. Here’s the code:


(my tree view constructor)

setName (T("MyTree"));

const String treexml ("<tree><item1><subnode colour=\"ffff00\"/></item1></tree>");

XmlDocument parser (treexml);

rootItem = new MyTreeViewItem(parser.getDocumentElement());
addAndMakeVisible (treeView = new TreeView());

treeView->setRootItem (rootItem);
treeView->setVisible(true);
rootItem->setOpen (true);

int x = treeView->getNumChildComponents();
	
resized();




Code from init() of main window:

treeList = new MyTreeView();
addAndMakeVisible(treeList);

x has a value of 1 if I break there. Any guidance would be great.

Thanks,

MT


#2

OK. I got it to draw by handling “resized()” in my MainWindow, but now the close button is gone.

What should I be doing in the resized override to make sure everything paints?

Thanks,

MT


#3

Actually, it was the ->setBounds call that was the ticket.

Really cool once you start catching on.

MT


#4