The wxList controls generated by XRCed are just that, and if I want to
use column sorting like the wxDemo list control demo I appear to need
multiple inheritance of wxColumnSorterMixin as well.
Is there a neat way to "retrospectively" insert the mixin into the list
control after creation, or some other way around the problem?
In article <diy7IGA4lcn$EwcC@octave.demon.co.uk>, Pythonologist
<pythonologist@octave.demon.co.uk> writes
Hi,
The wxList controls generated by XRCed are just that, and if I want to
use column sorting like the wxDemo list control demo I appear to need
multiple inheritance of wxColumnSorterMixin as well.
Is there a neat way to "retrospectively" insert the mixin into the list
control after creation, or some other way around the problem?
Many thanks for any input.
Actually, I found a solution as one can control the list from an
external class, viz;
However, I've now found another problem: the sorter zaps the alignment
of the column if it is anything other than the default (left aligned).
You can see this in the wxPython ListCtrl demo, where if you click the
music "Title" header, it makes it left aligned. This can't be correct
for numeric columns. So, how to reinstate alignment?
The wxList controls generated by XRCed are just that, and if I want to
use column sorting like the wxDemo list control demo I appear to need
multiple inheritance of wxColumnSorterMixin as well.
Is there a neat way to "retrospectively" insert the mixin into the list
control after creation, or some other way around the problem?
Take a look at the XRC subclass example that I posted here last week. You can create a subclass of wxListCtrl and wxColumnSorterMixin and then refer to that class in the XRC with the subclass attribute of the object tag.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
In article <diy7IGA4lcn$EwcC@octave.demon.co.uk>, Pythonologist
<pythonologist@octave.demon.co.uk> writes
Hi,
The wxList controls generated by XRCed are just that, and if I want to
use column sorting like the wxDemo list control demo I appear to need
multiple inheritance of wxColumnSorterMixin as well.
Is there a neat way to "retrospectively" insert the mixin into the list
control after creation, or some other way around the problem?
Many thanks for any input.
Actually, I found a solution as one can control the list from an
external class, viz;
I knew there was a good reason why I did it that way...
However, I've now found another problem: the sorter zaps the alignment
of the column if it is anything other than the default (left aligned).
You can see this in the wxPython ListCtrl demo, where if you click the
music "Title" header, it makes it left aligned. This can't be correct
for numeric columns. So, how to reinstate alignment?
What platform BTW?
Probably a bug, and it probably has to do with changing the column's image. wxColumnSorterMixin.__updateImages uses wxListCtrl.ClearColumnImage and SetColumnImage which look like this:
I would expect that to preserve the other column attributes, but apparently not. Can you experiment with this and see if you can come up with a workaround?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Traceback (most recent call last):
File "mailgui.py", line 473, in OnMenuFileExit
test_sm_up = self.il.Add( images.getSmallUpArrowBitmap( ) )
File "E:\software\python\Lib\site-packages\wxPython\demo\images.py",
line 3576, in getSmallUpArrowBitmap
return wxBitmapFromImage(getSmallUpArrowImage())
File "E:\software\python\lib\site-packages\wxPython\image.py",
line 394, in wxBitmapFromImage
val = imagec.wxBitmapFromImage(*_args,**_kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure"
failed in e:\Projects\wx2.4\src\msw\bitmap.cpp(507): invalid image
Traceback (most recent call last):
File "mailgui.py", line 473, in OnMenuFileExit
test_sm_up = self.il.Add( images.getSmallUpArrowBitmap( ) )
File "E:\software\python\Lib\site-packages\wxPython\demo\images.py",
line 3576, in getSmallUpArrowBitmap
return wxBitmapFromImage(getSmallUpArrowImage())
File "E:\software\python\lib\site-packages\wxPython\image.py",
line 394, in wxBitmapFromImage
val = imagec.wxBitmapFromImage(*_args,**_kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure"
failed in e:\Projects\wx2.4\src\msw\bitmap.cpp(507): invalid image
Does your app call wxInitAllImageHandlers?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!