Grid scrollbars don't appear when inserted into a sizer

I've started with the Grid/Grid Table code on pages 434-436 of
wxPython in Action, then decided to put it into a sizer so I could add
some combo boxes above the grid and control their placement.

When the Grid was not in a sizer, the grid's scrollbars appeared (and
I want them visible). When I moved the grid into the sizer, the
scrollbars do not appear, but I'm not sure why.

The full code is already posted from a recent email, but I've made the
change Robin suggested: that being making the grid a child of the
panel instead of the frame. Now the grid appears almost full size
inside of the sizer, but the scrollbars are gone.

Similarly, some other grid functionality was lost after moving the
grid into the sizer.
I've tried changing the Column headers by adding this code

   def _SetColumnHeaders(self):
      self._Grid.SetColLabelValue(0, 'Filename')
      for col in range(1, 14):
         self._Grid.SetRowLabelValue(col, 'STEP %lu' % col)

but the labels in the column headers does not change.

Is it normal for some functionality (other than positioning of the
grid) of a grid to change somewhat after being inserted into a sizer?

Tony,

From: Tony Cappellini [mailto:cappy2112@gmail.com]
Sent: Sunday, January 13, 2008 3:14 PM
To: wxpython-users@lists.wxwidgets.org
Subject: Grid scrollbars don't appear when inserted into a sizer

I've started with the Grid/Grid Table code on pages 434-436
of wxPython in Action, then decided to put it into a sizer so
I could add some combo boxes above the grid and control their
placement.

When the Grid was not in a sizer, the grid's scrollbars
appeared (and I want them visible). When I moved the grid
into the sizer, the scrollbars do not appear, but I'm not sure why.

The full code is already posted from a recent email, but I've
made the change Robin suggested: that being making the grid a
child of the panel instead of the frame. Now the grid appears
almost full size inside of the sizer, but the scrollbars are gone.

Similarly, some other grid functionality was lost after
moving the grid into the sizer.
I've tried changing the Column headers by adding this code

   def _SetColumnHeaders(self):
      self._Grid.SetColLabelValue(0, 'Filename')
      for col in range(1, 14):
         self._Grid.SetRowLabelValue(col, 'STEP %lu' % col)

but the labels in the column headers does not change.

Is it normal for some functionality (other than positioning of the
grid) of a grid to change somewhat after being inserted into a sizer?

There should be no change by putting the grid into a sizer or onto a
panel. It should function the same. It may look "cleaner" on a panel on
Windows, however.

I use a similar method to change my column's names, but I think you may be
doing your changes too early. Here's my method:

<code>

# create the grid and assign the grid object to a variable
self.sheet = SimpleGrid(self.panel, 17, 12)

for col in cols:
            self.sheet.SetColLabelValue(col, 'someValue')

</code>

That's it! And it works for me every time. I think you are manipulating
the grid before it instantiated, but I could be mistaken.

Mike

···

-----Original Message-----