The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!../../../perl -w

#
# Purpose:
#	To demonstrate the Perl5 Cdk Matrix Widget

#
# Initialize Cdk.
#
use Cdk;
Cdk::init();

# Set up the matrix field attibutes.
my @rowtitles = ("Course 1", "Course 2", "Course 3", "Course 4", "Course 5");
my @coltitles = ("Course", "Lec 1", "Lec 2", "Lec 3", "Flag");
my @colwidths = (7,5,5,5,1);
my @coltypes  = ("UMIXED", "UMIXED", "UMIXED", "UMIXED", "UMIXED");
my $x;

# Create the matrix object.
my $matrix = new Cdk::Matrix ('Rowtitles' => \@rowtitles,
				'Coltitles' => \@coltitles,
				'Colwidths' => \@colwidths,
				'Coltypes' =>  \@coltypes,
				'Vrows' => 3, 
				'Vcols' => $#coltitles+1,
				'Boxcell' => "TRUE",
				'Boxmatrix' => "TRUE",
				'Shadow' => "TRUE");

# Using this array, we will load up the matrix.
my @matrixValues = (["PSY340Y", "L0101", "L0201", "", ""],
			["PSY340H", "L0101", "L0201", "", ""],
			["PSY440Y", "L0101", "L0201", "", ""],
			["PSY201Y", "L0101", "L0201", "", ""]);

# Load up the matrix.
$matrix->set ('Values' => \@matrixValues);

# Draw the matrix.
$matrix->draw();

# Activate the matrix.
my ($rows, $cols, $info) = $matrix->activate ();

# Exit Cdk.
Cdk::end();

# Print out the information.
print "\n\n\n\n\n\n\n\n\n\n\n\n";
print "Rows: $rows Cols: $cols\n";
for ($x=0; $x < $rows; $x++)
{
   for ($y=0; $y < $cols; $y++)
   {
      print "Cell[$x][$y] = $info->[$x][$y],  ";
   }
   print "\n";
}
sleep (5);