wx.ListCtrl and auto full width for a single column

Marc Hedlund wrote:

Did you try the one in wx.lib.mixins.listctrl? It allows you to specify the col that should be resized.

One note on this -- I think the listctrl mixin has an off-by-one error in the way it uses indexes. As a result, if you say you want "setResizeColumn(0)," you'll get an assertion failure; if you say "setResizeColumn(1)" instead, the first column will be resized. Elsewhere in the ListCtrl class, the first column is 0, but not here.

I'm attaching the source for the listctrl mixin with no changes other than my comments as I was trying to figure out how to fix it; and then the class as I've changed it, to use zero-based column indexes.

The reason I haven't submitted this as a patch is that I realized my fix would break code for everyone using the current mixin. Robin, how do you like to handle changes like that?

It depends on the nature of the change, and how likely it is that people will scream if the change is made in a non backwards compatible way. :wink:

In this case, it would be easy to change the method name so that setResizeColumn() continued to work as it does now, and setAutoWidthColumn() or setGrowableColumn() or some such worked the way I think it should. You could even print a deprecation warning to stderr hinting that setResizeColumn shouldn't be used any more.

I think this makes the most sense for this case.

ยทยทยท

On Sun, 18 Jun 2006, Robin Dunn wrote:

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