Programmatically activating an element in a ListCtrl

Desilets, Alain wrote:

Thanks Robin,

I was able to generate a wxListEvent using wxEVT_COMMAND_LIST_ITEM_ACTIVATED
as the event type. But now I'm having difficulty setting its index value. I
tried setting the following:

* m_index
* m_itemIndex

With the first one, evt.GetIndex() still returns 0.

With the second one, I get the following traceback:

       #Traceback (most recent call last):
       # File
"C:\eclipse\workspace\VCode\Admin\wxWindowsWithHelpersTest.py", line 120,
       # in test_ActivateNth
       # self.dlg.list.ActivateNth(1)
       # File
"C:\eclipse\workspace\VCode\Mediator\wxWindowsWithHelpers.py", line 105,
       #in ActivateNth
       # evt.m_itemIndex = nth
       # File "C:\Python22\lib\site-packages\wxPython\controls2.py", line
399, in __set
       #attr__
       # controls2c.wxListEvent_m_itemIndex_set(self,value)
       #AttributeError: 'module' object has no attribute
'wxListEvent_m_itemIndex_set'

Looking at the C source code for wxPython, I have a feeling that m_itemIndex
is what I want to set, but it seems it's not public somehow.

It looks like you are using 2.4, and in that version I had all the data members of wxListEvent marked as readonly for some (currently unknown) reason.

Any way around this issue?

Unfortunaly not.

···

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