Hello,
You use GetClientSize() when calling ResizeColumns() which already gives
you the size of the ListCtrl *without* scrollbars.
From the documentation:
virtual wxSize GetClientSize() const
This gets the size of the window 'client area' in pixels. The client
area is the area which may be drawn on by the programmer, excluding
title bar, border, scrollbars, etc.
Here is the code I use to solve the same problem:
wx.EVT_SIZE(self, self.OnSize)
def OnSize(self, event):
size = self.GetClientSize()
width = size.width
i = 1
count = self.GetColumnCount()
while i < count:
width -= self.GetColumnWidth(i)
i += 1
self.SetColumnWidth(0, width)
event.Skip()
I still get this annoying horizontal scrollbar after I maximize then
minimize my frame. I tried to decrement the width of the first column
but the horizontal scrollbar still appears. Does anyone know how to hide
it?
···
-----Original Message-----
From: Adi Sieker [mailto:ml@sieker.info]
Sent: Friday, March 19, 2004 11:59 AM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] ListCtrl column resizing
Hi,
I have a ListCtrl with 3 columns.
the last 2 columns are going tobe fixed width and
the first one should fill up the rest of the space without causing
horizontal scroll bars.
I have this working, like this:
def ResizeColumns(self, size):
sb = wx.ScrollBar(self, style=wx.SB_VERTICAL)
sbSize = sb.GetSize()
sb.Destroy()
self.SetColumnWidth(0, size.width - 40 - sbSize.width -7)
self.SetColumnWidth(1, 20)
self.SetColumnWidth(2, 20)
and ResizeColumns get called like this:
def OnSize(self, event):
self.todoList.ResizeColumns(self.GetClientSize())
What annoys me is that I have to add an extra - 7 pixels
for this to work and I'm not sure that this will work on all Plattforms.
I would have thought that client size - scrollbar width would do the
trick.
Anyone have an idea
Regards
Adi
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org