Re: Layout questions with ListCtrl

Michael Eager <[email protected]> Wed, 9 Dec 2020 10:21:35 -0800
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
On 12/8/20 7:35 PM, Tim Roberts wrote:
> On Dec 8, 2020, at 11:07 AM, Michael Eager <[email protected]> wrote:
>>
>> I'm trying to use a ListCtrl in a SplitterWindow and I've been having trouble getting it to format correctly.  It turns out this isn't confusion caused by the SplitterWindow, but my lack of understanding of layout in ListCtrl.
>>
>> I created a simple app (attached) which creates a wx.Frame containing a wx.Panel which has a StaticText and wx.ListCtrl.  I've tried setting the column width at two different times (after the ListCtrl is created and after it is filled with data) and two different ways (with fixed size and AUTOSIZE).
>>
>> The only one which works is setting AUTOSIZE after filling in data. Setting fixed column widths doesn't work either time.  (testopt = 1)
> 
> Actually, they’re ALL working — it’s doing exactly what you asked.  The probiem is that you think the units for the width parameter are characters, whereas it is actually pixels.  Your columns are 10 and 20 pixels wide, which is very, very narrow.

Thanks.  That does help.

The only option which does not work is to specify AUTOSIZE before 
filling in the data (testopt=4).  I looked at the wxWindows 
implementation for QT and when SetColumnSize is called with this option, 
it immediately looks at the (non-existent) data and computes the column 
width.  There doesn't appear to be a flag set in the widget saying that 
when it is rendered to recalculate the column width.

-- 
Michael Eager

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/06a87e74-2733-a6c9-b23e-863a1de9a5f3%40eagercon.com.