Hello all,

    This is my second attempt at sending this message.  I sent it
earlier today, but a couple people reported that they received it
incompletely.  I don't know why.  I hope this'll work better.

  Anyhow, I am trying to understand how to set the size of a Wx::Grid
so that it looks decent.  I ran a simple test program (attached as
test.pl).  The relevant part is this:

  my $self = $class->SUPER::new($parent, -1, [20, 20], [$GRID_WIDTH,
$GRID_HEIGHT]);

$self is a Wx::Grid, so this is essentially:

  my $grid = Wx::Grid->new($parent, -1, [20, 20], [$GRID_WIDTH, $GRID_HEIGHT]);

The grid has three columns and five rows.  Each column is 100 pixels
wide, and the row label area is 50 pixels wide.  Plus there are five
one-pixel vertical border lines.  So the total width of the control
should be, I think, 355 pixels.  Likewise, the column label area is 32
pixels high, and each of the five rows is 17 pixels high, and there
are six one-pixel horizontal border lines, so the control should be
123 pixels high.

When $GRID_WIDTH is 355 and $GRID_HEIGHT is 123, the white background
of the control extends below and to the right of the actual control,
which looks terrible.  See the first image attached, wx-grid1.png.

When $GRID_WIDTH is 353 and $GRID_HEIGHT is 121, the control gets
scrollbars that block out part of the content. See the second image
attached, wx-grid2.png.

(I know someone's going to ask: What happens when you use values of
[354, 122]?!  :-)  Answer: it looks approximately the same as the
first scenario, the [355,123] set).

How do I make a Wx::Grid "as big as it needs to be" without scrollbars
and without spilling outside of the boundaries?  TIA.

-- 
Eric J. Roode

<<attachment: wx-grid1.png>>

<<attachment: wx-grid2.png>>

Attachment: test.pl
Description: Binary data

Reply via email to