wxPyAssertionError with wxListCtrl and wxListCtrlAutoWidthMixin

Hello,
the following error message is printed when resizing a wxListCtrl
combined with wxListCtrlAutoWidthMixin. This happens only
when a wxImageList is NOT associated with the wxListCtrl.

When a wxImageList is associated with wxListCtrl everything
works fine.
I use wxPython 2.4.0.7 running on python 2.2.1
Arye.

···

--------------------------------------------------
Traceback (most recent call last):
  File "c:\Python22\Lib\site-packages\wxPython\wx.py", line 1705, in <lambda>
    lambda event: apply(event.callable, event.args, event.kw) )
  File "c:\Python22\Lib\site-packages\wxPython\lib\mixins\listctrl.py", line 236, in _doResize
    self.SetColumnWidth(numCols-1, listWidth - totColWidth)
  File "c:\Python22\Lib\site-packages\wxPython\controls2.py", line 462, in SetColumnWidth
    val = apply(controls2c.wxListCtrl_SetColumnWidth,(self,) + _args, _kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in e:\projects\wx\src\msw\listctrl.cpp(2356): wxListCtrl::OnGetItemImage not supposed to be called
-------------------------------end error message

Arye Halioua wrote:

Hello,
the following error message is printed when resizing a wxListCtrl combined with wxListCtrlAutoWidthMixin. This happens only
when a wxImageList is NOT associated with the wxListCtrl.

When a wxImageList is associated with wxListCtrl everything
works fine.
I use wxPython 2.4.0.7 running on python 2.2.1
Arye.
--------------------------------------------------
Traceback (most recent call last):
  File "c:\Python22\Lib\site-packages\wxPython\wx.py", line 1705, in <lambda>
    lambda event: apply(event.callable, event.args, event.kw) )
  File "c:\Python22\Lib\site-packages\wxPython\lib\mixins\listctrl.py", line 236, in _doResize
    self.SetColumnWidth(numCols-1, listWidth - totColWidth)
  File "c:\Python22\Lib\site-packages\wxPython\controls2.py", line 462, in SetColumnWidth
    val = apply(controls2c.wxListCtrl_SetColumnWidth,(self,) + _args, _kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in e:\projects\wx\src\msw\listctrl.cpp(2356): wxListCtrl::OnGetItemImage not supposed to be called
-------------------------------end error message

Is it a virtual list control? If so, then you need to always provide a OnGetItemImage method, even if it just returns -1. If not, then it is a bug. Please distill it down to a small sample that shows the problem.

···

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

Arye, I had this problem when I moved from GTK/Linux to MSW. It's a
platform inconsistency and perhaps even an MSW-bug. I solved it by
adding this to my subclass of ListCtrl:

  def OnGetItemImage(self, item):
    return 0

···

On Monday 28 April 2003 12:18 pm, Arye Halioua wrote:

Hello,
the following error message is printed when resizing a wxListCtrl
combined with wxListCtrlAutoWidthMixin. This happens only
when a wxImageList is NOT associated with the wxListCtrl.

When a wxImageList is associated with wxListCtrl everything
works fine.
I use wxPython 2.4.0.7 running on python 2.2.1
Arye.
--------------------------------------------------
Traceback (most recent call last):
  File "c:\Python22\Lib\site-packages\wxPython\wx.py", line 1705, in
<lambda> lambda event: apply(event.callable, event.args, event.kw) )
File "c:\Python22\Lib\site-packages\wxPython\lib\mixins\listctrl.py",
line 236, in _doResize self.SetColumnWidth(numCols-1, listWidth -
totColWidth)
  File "c:\Python22\Lib\site-packages\wxPython\controls2.py", line
462, in SetColumnWidth val =
apply(controls2c.wxListCtrl_SetColumnWidth,(self,) + _args, _kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure"
failed in e:\projects\wx\src\msw\listctrl.cpp(2356):
wxListCtrl::OnGetItemImage not supposed to be called
-------------------------------end error message

--
Chuck
http://ChuckEsterbrook.com

The docs explicitly state that you don't have to override that method
*if* you don't have an image list associated with the control. And
that's the behavior on GTK/Linux. Only on MSW did I have to provide
that method, so that seems like a bug.

fyi,

···

On Monday 28 April 2003 12:42 pm, Robin Dunn wrote:

Is it a virtual list control? If so, then you need to always provide
a OnGetItemImage method, even if it just returns -1. If not, then it
is a bug. Please distill it down to a small sample that shows the
problem.

--
Chuck
http://ChuckEsterbrook.com