Deleting Highlighted Item in wx.ListCtrl

I have a wx.ListCtrl assigned to the variable 'lc'. To remove one string
from the list, that string is selected by left clicking the mouse when the
cursor is on that line, then pressing the "Clear" button. That calls the
code:

  sel_items = self.lc.GetSelectedItemCount()
     if sel_items > 0:
       self.lc.DeleteItem()

   Is this the proper set of methods, used correctly?

TIA,

Rich

···

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

If what you are doing isn't doing what you want it to, then either you
aren't doing the right thing, or the documentation doesn't match the
implementation.

According to the demo (and a bit of thinking that if you delete item 4,
item 5 becomes item 4), you can use...

index = self.c.GetFirstSelected()
it =
while index != -1:
    it.append(index)
    index = self.lc.GetNextSelected(index)

it.sort()
it.reverse()

for item in it:
    self.lc.DeleteItem(item)

- Josiah

···

Rich Shepard <rshepard@appl-ecosys.com> wrote:

   I have a wx.ListCtrl assigned to the variable 'lc'. To remove one string
from the list, that string is selected by left clicking the mouse when the
cursor is on that line, then pressing the "Clear" button. That calls the
code:

  sel_items = self.lc.GetSelectedItemCount()
     if sel_items > 0:
       self.lc.DeleteItem()

   Is this the proper set of methods, used correctly?

Josiah,

   Thanks again.

Rich

···

On Mon, 26 Dec 2005, Josiah Carlson wrote:

index = self.c.GetFirstSelected()
it =
while index != -1:
   it.append(index)
   index = self.lc.GetNextSelected(index)
it.sort()
it.reverse()
for item in it:
   self.lc.DeleteItem(item)

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863