[wxruby-users] Problem with ListCtrl Width
Alex Fenton
alex at pressure.to
Mon Mar 23 16:23:26 EDT 2009
Michael Satterwhite wrote:
> The problem is that the sizer is squeezing the width of the list control
> down to the point that only a column and a half are visible without
> horizontal scrolling. The form is actually wide enough that it should be
> able to display all the columns.
>
> How do I tell the layout to expand the width of the wxListCtrl?
>
Hard to be certain without seeing the whole context, but I'd guess you
should be adding a Wx::GROW flag to the sizer#add calls. This tells the
Sizer to expand that item to fill all the space in the non-main sizer
direction. So, if the sizer's vertical, adding Wx::GROW (or Wx::EXPAND,
it's a synonym), the listctrl will fill all the horizontal space available.
A few random hints:
> Here's my code for the ListCtrl:
>
> #Put the item list on the screen
> @itemSizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
>
@itemSizer = Wx::HBoxSizer.new
And, are you sure you need two sizers?
> @itemList = Wx::ListCtrl.new(self, -1,
> Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
> Wx::LC_REPORT | Wx::LC_HRULES | Wx::LC_VRULES)
>
@itemList = Wx::ListCtrl.new(self, :style =>
Wx::LC_REPORT|Wx::LC_HRULES|Wx::LC_VRULES)
alex
More information about the wxruby-users
mailing list