I have a window with a vertical box sizer with many items. The last
item is a ListCtrl to which items will be added dynamically. I've
added the list to the sizer this way:
self.mainSizer.Add(self.list, proportion=0, flag=wx.EXPAND)
This keeps the height of the list constant even when there is space
remaining in the parent window for the list to expand into. However I
don't want the list occupying the whole remaining space if it doesnt
have that many items.
How can I make the ListCtrl to be resized on item addition so that its
height is sufficient to show all the rows without showing a vertical
scrollbar unless necessary.
Many thanks in advance.
PS: Please CC me since I am not subscribed to the list.
I have a window with a vertical box sizer with many items. The last
item is a ListCtrl to which items will be added dynamically. I've
added the list to the sizer this way:
self.mainSizer.Add(self.list, proportion=0, flag=wx.EXPAND)
This keeps the height of the list constant even when there is space
remaining in the parent window for the list to expand into. However I
don't want the list occupying the whole remaining space if it doesnt
have that many items.
How can I make the ListCtrl to be resized on item addition so that its
height is sufficient to show all the rows without showing a vertical
scrollbar unless necessary.
I'm afraid you'll have to figure out the desired height on your own as the listctrl isn't that smart. Once you've got the height you want to set, pass it to the listctrl's SetMinSize, and then call the sizer's Layout method.
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!