Negative selection values in wxListCtrl?

It appears as though SetItemState() allows you to set the state of a
negative item without raising any exception.

That is,

   MyListBox.SetItemState(-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)

executes without a complaint and then a call to GetFirstSelected() returns
-1 (nothing selected). At some point later (maybe in the event loop? I
can't tell.) An "Error" dialog box pops up and says "Couldn't retrieve
information about list control item -1." I take it this results from some
of my code trying to do something with item -1 since it has blown through
my try/except test.

Is this how SetItemState() should be expected to work. I kind of expected
an exception when trying to set the state of a bogus item.

···

--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456

SetItemState doesn't assert that the item is valid. It proabbly should. Please enter a bug report about this.

···

gary.h.merrill@gsk.com wrote:

It appears as though SetItemState() allows you to set the state of a
negative item without raising any exception.

That is,

   MyListBox.SetItemState(-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)

executes without a complaint and then a call to GetFirstSelected() returns
-1 (nothing selected). At some point later (maybe in the event loop? I
can't tell.) An "Error" dialog box pops up and says "Couldn't retrieve
information about list control item -1." I take it this results from some
of my code trying to do something with item -1 since it has blown through
my try/except test.

Is this how SetItemState() should be expected to work. I kind of expected
an exception when trying to set the state of a bogus item.

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