wx.ListEvent in report mode

Suzuki Alex Alex.Suzuki at ksta.ktzh.ch
Mon Dec 18 05:03:28 PST 2006


Hi all,

  I'm using a ListCtrl in report mode with two columns. I'm adding the
(string) items like this:

for i in range(len(result)):
	data = result[i]
	listctrl.InsertStringItem(i, data[0]) # first column
	listctrl.SetStringItem(i, 1, data[1]) # second column

  This works fine. However, if I wish to process a wx.ListEvent,
for instance right-clicking on an item, I do not know how to get the
column information back. wx.ListEvent.GetIndex() yields the correct index.
wx.ListEvent.GetColumn() is not usable since the event is not a COL_
event, it returns 0. The item provided by wx.ListEvent.GetItem() is
also not usable, its index, column and text are zero, zero and blank.

  What is the correct way to retrieve the text of an item that has
been clicked in a multi-column list control?

Thanks in advance,
  Alex Suzuki





More information about the wxpython-users mailing list