wxTreeCtrl Change

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?

Yes. This is a big problem. I've been trying for a few hours to
demo the problem with a small app, and I can't make it happen.
All I can do is show that

  aTree.GetItemText(aTree.GetRootItem())

fails if the root is hidden. Whether this failed before or not,
IDK.

I've got a big app that definitely shows the problem. I create
the tree control with style = wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS.
It goes through some machinations that I'm not sure what these
all are, but by the time it gets to where the tree data is deleted
to be re-filled with new data, there it acts as if it has lost the
wxTR_HIDE_ROOT style. I do a aTree.GetItemText(aTree.GetRootItem()),
and it works and gives me the text of the visible item, not the text
of the hidden root to which the visible item was appended. When I do
that on a newly created tree with wxTR_HIDE_ROOT, it fails, saying
that the virtual root is not accessible. I search my code and I
see that I set wxTR_HIDE_ROOT wherever I creae a wxTreeCtrl, and
I only create this one in one place, so IDK what's up.

I've got an executable of the same app (via McMillan) from 1 month
ago that definitely does not show the problem. Deleting all the children
of the root deleted all the items visible in the tree
control on that one. I don't believe I've made any changes to
my code cause this to start happening. But it's one of those mysteries,
sorry. I really don't want to re-load 2.4.1.2 to show
for sure that it did work. My large app is showing the problem,
but all I can get out of a simple test app is that trying to
pull the item text out of the hidden root item crashes. IDK if
that failed before or not.

Some of the things that it goes through include Freeze()'s,
Thaw()'s, and Clear()'s. Could any of those be causing the
attribute to get lost? IDK. I look in the docs for a
GetStyle() method so I can test to see where the style changes,
but there isn't one. Is there any other way to query the
internals of the style to see what's going on?

I can work around this by simply deleting the whole tree with
DeleteAllItems() and re-creating the hidden root, too, but I
figured that you would want to figure out what was happening.

The only other unusual thing is that I've got two tree controls
in the same frame that both use wxTR_HIDE_ROOT. Could there be
any interaction between these that causes some foul up of the
styles?

Thanks for the info.

Al

achrist@easystreet.com wrote:

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?

Yes. This is a big problem. I've been trying for a few hours to
demo the problem with a small app, and I can't make it happen.
All I can do is show that

  aTree.GetItemText(aTree.GetRootItem())

fails if the root is hidden. Whether this failed before or not, IDK.

It probably did.

I've got a big app that definitely shows the problem. I create
the tree control with style = wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS.
It goes through some machinations that I'm not sure what these
all are, but by the time it gets to where the tree data is deleted
to be re-filled with new data, there it acts as if it has lost the
wxTR_HIDE_ROOT style. I do a aTree.GetItemText(aTree.GetRootItem()),
and it works and gives me the text of the visible item, not the text
of the hidden root to which the visible item was appended. When I do
that on a newly created tree with wxTR_HIDE_ROOT, it fails, saying
that the virtual root is not accessible. I search my code and I
see that I set wxTR_HIDE_ROOT wherever I creae a wxTreeCtrl, and
I only create this one in one place, so IDK what's up.

Some of the things that it goes through include Freeze()'s, Thaw()'s, and Clear()'s. Could any of those be causing the
attribute to get lost?

Not unless it is the natvie control that is losing the attribute. None of them affect the style value that the wxWindow class holds.

IDK. I look in the docs for a GetStyle() method so I can test to see where the style changes,
but there isn't one. Is there any other way to query the internals of the style to see what's going on?

GetWindowStyleFlag

The only other unusual thing is that I've got two tree controls
in the same frame that both use wxTR_HIDE_ROOT. Could there be
any interaction between these that causes some foul up of the
styles?

There shouldn't be.

···

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