[Q]: wxTreeCtrl and IsOK

For a wxTreeCtrl T that contains an Item I, I do:

  T.Delete(I)

Immediately following:

  assert not I.IsOk()

The assertion fails. The deleted item is ok?

It's out of the tree. The Delete(I) takes it out.

I've got redundant data structures -- another data structure
contains some of the same data as the tree. I'm trying to
check if they are staying correctly in sync. Would be nice
if a deleted item wasn't ok.

The OS is Win 2k Pro, SP 4.

Python is 2.3. wxWindows 2.4.1.2.

Thanks for any advice or easy way to check for a deleted item.

Al

achrist@easystreet.com wrote:

For a wxTreeCtrl T that contains an Item I, I do:

  T.Delete(I)

Immediately following:

  assert not I.IsOk()

The assertion fails. The deleted item is ok?

It's out of the tree. The Delete(I) takes it out.

I've got redundant data structures -- another data structure
contains some of the same data as the tree. I'm trying to
check if they are staying correctly in sync. Would be nice if a deleted item wasn't ok.

The IsOk method (and the wxTreeItemId class too for that matter) is very simple and is just meant to check if the item was a valid handle when it was created. It does not have a reference to the wxTreeCtrl to check if it is still valid.

···

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