views:

15

answers:

1

I'm using wxWidgets 2.8.11 on Windows 7 64 Bit. I created a wxTreeCtrl control, which as the name suggests, is a tree control. You can add Root nodes by calling AddRoot(), however it seems to only work the first time of calling it.

Here is the code where I create the Tree:

newHandler-> sendPacketTree = new wxTreeCtrl(newHandler->sendGroupBox,4,wxPoint(7,12),wxSize(newHandler->sendGroupBox->GetSize().x-14,newHandler->sendGroupBox->GetSize().y-20),wxTR_DEFAULT_STYLE);

Here is what I'm doing just as a test:

this->sendPacketTree->AddRoot(wxT("Test1"));
this->sendPacketTree->AddRoot(wxT("Test2"));

However, only the first root node appears in the Tree, and the second node doesn't appear (or any other node after the first node for that matter)

Does anyone know why this is happening, or how I can get around this? I'm stumped.

+1  A: 

I found a solution on my own. I thought that AddRoot() allowed you to add more then one root. It turns out you can only have one root, but you are able to hide the actual "root", and any children of the root will look like a root with the wxTR_HIDE_ROOT style set.

Brad
+1 for posting your own solution
Wolfgang Plaschg