Opened 11 years ago

Closed 5 years ago

Last modified 5 years ago

#4024 closed defect (outdated)

wxTreeCtrl with single selection, selects more then 1 item

Reported by: g00fy Owned by:
Priority: normal Milestone:
Component: wxMSW Version:
Keywords: wxTreeCtrl Cc: g00fy
Blocked By: Blocking:
Patch: no


wxTreeCtrl -> just the default sample.

Please apply the attached patch.

VS 2005/1

I think this is an MSW bug, because the API-calls return all success (like they should do, but they don't do it).

Now what don't they do?

The attached patch will select the rootitem when creating the tree. Upon selchange, it will expand the selected item.

This works nice for the rootitem, but if you select another item, you notice that the selection of the rootitem is not moved.

Also when you do GetSelections(), you get "2" as a result. Very weird indeed under a tree with the wxTR_MULTIPLE NOT set...

Solving this can be done with selecting the rootitem again, and selecting the other element...


Attachments (3)

treetest.cpp.patch download (1.1 KB) - added by g00fy 11 years ago.
treetest.cpp.test_29svn.patch download (1.1 KB) - added by catalin 5 years ago.
treetest.cpp.improvments.patch download (2.0 KB) - added by catalin 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by g00fy

comment:1 Changed 11 years ago by g00fy

another thing is if you do UnselectAll() followed by a select( <item> ); it will not remove any selection, but just select the new one...
Even if you add wxYield() between the calls.

Hope this helps for finding a solution :)

comment:2 Changed 10 years ago by wojdyr

  • Component set to wxMSW
  • Keywords wxTreeCtrl added

Changed 5 years ago by catalin

Changed 5 years ago by catalin

comment:3 Changed 5 years ago by catalin

The reported behaviour does not happen in 2.9svn. Neither the one in comment:1.

There are a couple of small improvements to the sample in the last patch.

comment:4 Changed 5 years ago by vadz

  • Resolution set to outdated
  • Status changed from new to closed

comment:5 Changed 5 years ago by VZ

(In [73479]) Don't show log menu tiems in the tree control sample when !wxUSE_LOG.

No real changes, just correct the "#if wxUSE_LOG" placement.

See #4024.

Note: See TracTickets for help on using tickets.