[wxPython] win32 wxTreeCtrl SortChildren()/SetItemImage () bug
well, after some tests I found that when a
tree.SetItemImage (item, image,
wxTreeItemIcon_Expanded/SelectedExpanded)
is issued on a win(2000) platform, the tree.SortChildren() function does
not work any more,
neither in my code nor in the demo (no PyData or GetItemText available).
I’m using wxPython 2.3.1
Solutions and comments?
It works for me, so it may be something that has already been fixed for
2.3.2.
Robin,
I was searching for a solution to a problem, and came across this old(ish) message that describes my symptoms exactly. The difference is that I’m using Python 2.2 and wxPython 2.3.2.1. This is on Windows NT 4 Service Pack 5 or 6, and (because people were mentioning it in a similar problem in the C wxWindows lists) comctrl32.dll version 5.81 [curiously the “Other version information” areas “Product Name” says “Microsoft(R) Windows (R) 2000 Operating System” - could this be causing a problem on my NT4 box???]
In my case I create a tree of objects with random names. If I then use SortChildren() any Item that had it’s Expanded icon set with SetItemImage() ends up at the top of the sorted children. Note that the tree looks and behaves properly, and shows all labels correctly. If I then comment out the call to SetItemImage(), the items that did end up at the top are now intermingled with the other items correctly.
Overriding OnCompareItems and printing the GetItemText() of the two passed items, shows the correct labels for items that do not use SetItemImage(), but empty strings for any item that does use it, (hence the incorrect ordering). I’m not using PyData yet, so can’t say anything on that score. I’m guessing that the default SortChildren() uses GetItemText() for it’s sort routine, hence the problem seen by the original poster.
If it would help I can try and knock together a minimal version demonstrating the problem, and e-mail it to you for verification.
Finally I’d just like to say that, all in all, I think wxPython is an excellent package (not that I’m a guru of gui’s or anything
Regards
Steve
The following links indicate a similar problem in C
http://lists.wxwindows.org/pipermail/wx-users/2001-December/015922.html
http://lists.wxwindows.org/pipermail/wx-users/2001-April/008922.html
`
···
=========================================================
This electronic message contains information from the mmO2 plc Group
which may be privileged or confidential. The information is intended to be
for the use of the individual(s) or entity named above. If you are not the
intended recipient be aware that any disclosure, copying, distribution or
use of the contents of this information is prohibited. If you have received
this electronic message in error, please notify us by telephone or email
(to the numbers or address above) immediately.
=========================================================
`