> Thanks for your reply.  U mentioned an attached
> file,but I don't see it.  I think the listserver
> stripped away the attached file.  Maybe if you can cut
> and paste it into the message that might work.

See below.

Laurent.


#! perl -w
#
# Test Basic Grid method
#
use strict;
use Win32::GUI;
use Win32::GUI::Grid;

# main Window
my $Window = new Win32::GUI::Window (
    -title    => "Win32::GUI::Grid test 7",
    -pos     => [100, 100],
    -size    => [400, 400],
    -name     => "Window",
) or die "new Window";

# Grid Window
my $Grid = new Win32::GUI::Grid (
    -parent  => $Window,
    -name    => "Grid",
    -pos     => [0, 0],
    -fixedrows    => 1,
    -fixedcolumns => 1,
    -editable => 0,
) or die "new Grid";

# Fill Grid
my @fields = ("Field1","Field2","Field3","Field4", "Field5");

# InsertColumn (strHeading, [nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE],
[nColumn = -1]) => icol
for my $field (0..$#fields) {
  my $icol = $Grid->InsertColumn($fields[$field]);
}

for my $row (1..10) {
  # InsertRow (strHeading, [nRow = -1]) => irow
  my $irow = $Grid->InsertRow("Row $row", -1);

  for my $icol (0..$#fields) {
    $icol += $Grid->GetFixedColumns();
    $Grid->SetCellText($irow, $icol, "Cell : ($irow,$icol)");
  }
}

# Resize Grid Cell
$Grid->AutoSize();

# Event loop
$Window->Show();
Win32::GUI::Dialog();

# Main window event handler
sub Window_Terminate {

  return -1;
}

sub Window_Resize {

  my ($width, $height) = ($Window->GetClientRect)[2..3];
  $Grid->Resize ($width, $height);
}


Reply via email to