ListCtrl LC_REPORT - no image in first column

Hi,

I have a list control in report mode, which I allow the user to sort with
mixins.ColumnSorterMixin. When a column is clicked on it places a sort arrow on
the column header. Pretty standard stuff.

My list control is populated with InsertStringItem - i.e. I don't insert an
image to appear in the first column.

However the first column of the list control has a blank spacer to the left of
the text where an image should be.

Is there any way to remove this so that the text in the first column is flush
with the left hand border?

Thanks,
Steve.

Hi Steve,

My list control is populated with InsertStringItem - i.e. I don't insert an
image to appear in the first column.

However the first column of the list control has a blank spacer to the left of
the text where an image should be.

Is there any way to remove this so that the text in the first column is flush
with the left hand border?

No, I don't think is there a way to do it: when you use
ColumnSorterMixin, you are assigning an image list to wx.ListCtrl
(because of the sort arrows in the column headers). At this point,
wx.ListCtrl is so intelligent (!) to think that you will absolutely
use images also in the first column and it leaves the blank space to
accomodate a non-existing image.
Maybe someone more knowledgeable than me will find a workaround for
this issue :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 9/26/07, Steve Senior wrote:

Andrea Gavana wrote:

Hi Steve,

My list control is populated with InsertStringItem - i.e. I don't insert an
image to appear in the first column.

However the first column of the list control has a blank spacer to the left of
the text where an image should be.

Is there any way to remove this so that the text in the first column is flush
with the left hand border?

No, I don't think is there a way to do it: when you use
ColumnSorterMixin, you are assigning an image list to wx.ListCtrl
(because of the sort arrows in the column headers). At this point,
wx.ListCtrl is so intelligent (!) to think that you will absolutely
use images also in the first column and it leaves the blank space to
accomodate a non-existing image.
Maybe someone more knowledgeable than me will find a workaround for
this issue :smiley:

Unlikely. It's actually the native microsoft control that is doing that. They assume that if there is an imagelist then there will be images on the items, and leave room for them whether you want it or not. The only way to workaround it that I know of is to not set any text for the first column, and then set the column width to zero. Personally I think it is much nicer to just give the items an image, even if they are all the same.

···

On 9/26/07, Steve Senior wrote:

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

Robin Dunn <robin <at> alldunn.com> writes:

  The only way to workaround it that I know of is to not set any text
for the first column, and then set the column width to zero. Personally
I think it is much nicer to just give the items an image, even if they
are all the same.

Ah, yes.

That sounds like a sensible workaround. I will give that a try.

Thanks.

Robin Dunn <robin <at> alldunn.com> writes:

  The only way to workaround it that I know of is to not set any text
for the first column, and then set the column width to zero.

Robin,

Many thanks for the suggestion - sometimes you can't see the wood for the trees.

Needless to say it worked like an absolute charm.

Steve.