开发者

wxWidgets AddRoot() on wxTreeCtrl fails to add more then one node

开发者 https://www.devze.com 2023-01-14 17:04 出处:网络
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 wo

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 wor开发者_如何学编程k 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消