wxTreeCtrl Change

I've noticed that the behavior of wxTreeCtrl in the 2.4.2.4 is not
very consistent with previous.

I have a tree control theat I set up with the wxTR_HIDE_ROOT style.
This works fine and always has, the root is hidden. It happens that
the root has only one branch that is visible. So, I've got what looks
like a visible root, since the whole contents of the tree are
connected under the one visible top-level entry. But its not.
I create the root with aTree.AddRoot("root") and the "root"
item stays hidden. This works fine and always has.

Problem comes when the user decides to refill the tree with new data.
The program calls:

  aTree.DeleteChildren(aTree.GetRootItem())

This works differently now. It seems that aTree.GetRootItem()
returns not the root, but the visible top-level item in the
tree. So, I get left with a visible item in the tree after
deleting all the children of aTree.GetRootItem(), even though
the root is supposed to be hidden, and when the user fills their
new data into the tree, it gets hung on the top-level item of the
old data, not on the hidden root.

I can live with this and change my code if it's intended behavior,
bot it looks like a bug.

Any ideas?

This happens on Win2k, WinNT, and Win98. It did not happen with
wxPython 2.4.1.2, but it does with 2.4.2.4.

TIA

Al

achrist@easystreet.com wrote:

I've noticed that the behavior of wxTreeCtrl in the 2.4.2.4 is not
very consistent with previous.

I have a tree control theat I set up with the wxTR_HIDE_ROOT style.
This works fine and always has, the root is hidden. It happens that
the root has only one branch that is visible. So, I've got what looks
like a visible root, since the whole contents of the tree are connected under the one visible top-level entry. But its not.
I create the root with aTree.AddRoot("root") and the "root" item stays hidden. This works fine and always has.

Problem comes when the user decides to refill the tree with new data.
The program calls:

  aTree.DeleteChildren(aTree.GetRootItem())

This works differently now. It seems that aTree.GetRootItem() returns not the root, but the visible top-level item in the tree. So, I get left with a visible item in the tree after deleting all the children of aTree.GetRootItem(), even though
the root is supposed to be hidden, and when the user fills their
new data into the tree, it gets hung on the top-level item of the
old data, not on the hidden root.

I can live with this and change my code if it's intended behavior,
bot it looks like a bug.

Browsing CVS I don't see any changes that should have caused that, and GetRootItem itself hasn't changed since before 2.4.0. Can you please provide a sample app?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!