Hi,
I use wxTreeCtrl with the style wxTR_MULTIPLE. Under some circumstances I found a strange behaviour in my application. There are missing selection changed events under the conditions I’ll describe below:
Select Item 1, (multi)select Item(s) 2...n.
If I unselect the last selected Item no Event is received by my application that applies for all following left-clicks on this item. Same behaviour I can see running the sample application “treetest.cpp” coming with wxWidgets.
I'm currently using wxWidgets 2.8.7 Windows. Is there any solution for this issue in the meantime?
Thanks
wxTreeCtrl with the style wxTR_MULTIPLE, missing events
I fixed that problem by using on mouse left button up event. There was nothing else which gets notified if you select and unselect the same item (using CTRL key). I did something like this
then
Hope that helps
Code: Select all
tree->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(TreeView::OnMouseUp), NULL, this);
Code: Select all
void TreeView::OnMouseUp(wxMouseEvent& e)
{
wxArrayTreeItemIds mSelectedItems;
mTreeCtrl->GetSelections(mSelectedItems);
//mSelected items will have corrent number of selected items now
}
Who doubts nothing, Knows nothing