开发者

wxwidgets wxtreectrl wxTR_HAS_BUTTONS does not enable plus minus buttons next to tree

开发者 https://www.devze.com 2023-02-05 03:50 出处:网络
When I create a treectrl item with wxTR_HAS_BUTTONS enabled, no buttons seem to show. I am compiling using VC++ 2008.

When I create a treectrl item with wxTR_HAS_BUTTONS enabled, no buttons seem to show. I am compiling using VC++ 2008.

    treectrlModelTree = new wxTreeCtrl( itemPanel3, ID_TREECTRL_MODEL_TREE, wxD开发者_JAVA百科efaultPosition, wxDefaultSize, wxTR_EDIT_LABELS|wxTR_HAS_BUTTONS |wxTR_SINGLE|wxSUNKEN_BORDER );

I am adding the root with:

wxTreeItemId rootId = treectrlModelTree->AddRoot("Model Tree", -1, -1,  new MyTreeItemData((void*)group));

and appending data to the tree with the AppendItem() command:

wxTreeItemId tempItem = treectrlModelTree->AppendItem(groupId, tmpstr, -1, -1, new MyTreeItemData(tracker->model));

I tried searching around but it does not seem like there are too many posts online about treectrl problems.


I figured it out,

It has to do with a bug in wxwidgets 2.8.9 where dragging items within the treectrl will give an error when there is no images assigned to a treectrl (i.e. folder images).

See: [http://trac.wxwidgets.org/ticket/4390][1]

I was using a quick fix suggested, to add a dummy image list

treectrlModelTree->AssignImageList(new wxImageList(1, 1));

which suppressed the plus/minus buttons for the treectrl.

0

精彩评论

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