################### Labels ################### my $descriptionrow1 = $row1->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 9, -padx => 8); my $t1 = $descriptionrow1->Label(-text => 'Serial Number ', -background => 'cyan',)->pack(); $t1 = $descriptionrow1->Label(-text => 'Part Number', -background => 'cyan',)->pack(); $t1 = $descriptionrow1->Label(-text => 'Status', -background => 'cyan',)->pack(); #################### Slot 01 #################### my $slot1 = $row1->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot1 = $slot1->Label(-text => 'Slot 01', -background => 'cyan')->pack(); #my $sernumSlot1 = $slot1->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[1], -validate => 'key', -validatecommand => sub {$_[1] =~ /[0-9]/}, -invalidcommand => sub {$main->bell})->pack(); #my $sernumSlot1 = $slot1->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[1], -validate => 'focusout', -validatecommand => sub {return($_ =~ /\d{8}/)}, -invalidcommand => sub {$main->bell})->pack(); my $sernumSlot1 = $slot1->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[1], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot1 = $slot1->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[1], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot1 = $slot1->Label(-text => '1dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot1 = $slot1->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 01 #################### #################### Slot 02 #################### my $slot2 = $row1->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot2 = $slot2->Label(-text => 'Slot 02', -background => 'cyan')->pack(); my $sernumSlot2 = $slot2->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[2], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot2 = $slot2->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[2], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot2 = $slot2->Label(-text => '2dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot2 = $slot2->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 02 #################### #################### Slot 03 #################### my $slot3 = $row1->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot3 = $slot3->Label(-text => 'Slot 03', -background => 'cyan')->pack(); my $sernumSlot3 = $slot3->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[3], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot3 = $slot3->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[3], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot3 = $slot3->Label(-text => '3dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot3 = $slot3->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 03 #################### #################### Slot 04 #################### my $slot4 = $row1->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot4 = $slot4->Label(-text => 'Slot 04', -background => 'cyan')->pack(); my $sernumSlot4 = $slot4->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[4], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot4 = $slot4->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[4], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot4 = $slot4->Label(-text => '4dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot4 = $slot4->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 04 #################### my $line2 = $main->Frame(-borderwidth => 3, -relief => 'groove', -background => 'gray')->pack(-side => 'top'); my $row2info = $line2->Label(-text => "Slots 04 - 08", -width => $width, -height => 0, -foreground => 'black', -background => 'gray')->pack(); #################### Row 2 Frame #################### my $row2 = $main->Frame(-background => 'cyan',)->pack(-side => 'top', -fill => 'x'); my $descriptionrow2 = $row2->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 9, -padx => 8); my $t2 = $descriptionrow2->Label(-text => 'Serial Number ', -background => 'cyan',)->pack(); $t2 = $descriptionrow2->Label(-text => 'Part Number', -background => 'cyan',)->pack(); $t2 = $descriptionrow2->Label(-text => 'Status', -background => 'cyan',)->pack(); #################### Row 2 Frame #################### #################### Slot 05 #################### my $slot5 = $row2->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot5 = $slot5->Label(-text => 'Slot 05', -background => 'cyan')->pack(); my $sernumSlot5 = $slot5->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[5], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot5 = $slot5->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[5], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot5 = $slot5->Label(-text => '5dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot5 = $slot5->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 05 #################### #################### Slot 06 #################### my $slot6 = $row2->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot6 = $slot6->Label(-text => 'Slot 06', -background => 'cyan')->pack(); my $sernumSlot6 = $slot6->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[6], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot6 = $slot6->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[6], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot6 = $slot6->Label(-text => '6dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot6 = $slot6->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 06 #################### #################### Slot 07 #################### my $slot7 = $row2->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot7 = $slot7->Label(-text => 'Slot 07', -background => 'cyan')->pack(); my $sernumSlot7 = $slot7->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[7], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot7 = $slot7->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[7], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot7 = $slot7->Label(-text => '7dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot7 = $slot7->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 07 #################### #################### Slot 08 #################### my $slot8 = $row2->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot8 = $slot8->Label(-text => 'Slot 08', -background => 'cyan')->pack(); my $sernumSlot8 = $slot8->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[8], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot8 = $slot8->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[8], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot8 = $slot8->Label(-text => '8dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot8 = $slot8->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 08 #################### my $line3 = $main->Frame(-borderwidth => 3, -relief => 'groove', -background => 'gray')->pack(-side => 'top'); my $row3info = $line3->Label(-text => "Slots 09 - 12", -width => $width, -height => 0, -foreground => 'black', -background => 'gray')->pack(); #################### Row 3 Frame #################### my $row3 = $main->Frame(-background => 'cyan',)->pack(-side => 'top', -fill => 'x'); my $descriptionrow3 = $row3->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 9, -padx => 8); my $t3 = $descriptionrow3->Label(-text => 'Serial Number ', -background => 'cyan',)->pack(); $t3 = $descriptionrow3->Label(-text => 'Part Number', -background => 'cyan',)->pack(); $t3 = $descriptionrow3->Label(-text => 'Status', -background => 'cyan',)->pack(); #################### Row 3 Frame #################### #################### Slot 09 #################### my $slot9 = $row3->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot9 = $slot9->Label(-text => 'Slot 09', -background => 'cyan')->pack(); my $sernumSlot9 = $slot9->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[9], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot9 = $slot9->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[9], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot9 = $slot9->Label(-text => '9dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot9 = $slot9->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 09 #################### #################### Slot 10 #################### my $slot10 = $row3->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot10 = $slot10->Label(-text => 'Slot 10', -background => 'cyan')->pack(); my $sernumSlot10 = $slot10->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[10], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot10 = $slot10->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[10], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot10 = $slot10->Label(-text => '10dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot10 = $slot10->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 10 #################### #################### Slot 11 #################### my $slot11 = $row3->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot11 = $slot11->Label(-text => 'Slot 11', -background => 'cyan')->pack(); my $sernumSlot11 = $slot11->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[11], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot11 = $slot11->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[11], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot11 = $slot11->Label(-text => '11dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot11 = $slot11->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 11 #################### #################### Slot 12 #################### my $slot12 = $row3->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot12 = $slot12->Label(-text => 'Slot 12', -background => 'cyan')->pack(); my $sernumSlot12 = $slot12->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[12], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot12 = $slot12->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[12], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot12 = $slot12->Label(-text => '12dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot12 = $slot12->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 12 #################### my $line4 = $main->Frame(-borderwidth => 3, -relief => 'groove', -background => 'gray')->pack(-side => 'top'); my $row4info = $line4->Label(-text => "Slots 13 - 16", -width => $width, -height => 0, -foreground => 'black', -background => 'gray')->pack(); #################### Row 4 Frame #################### my $row4 = $main->Frame(-background => 'cyan',)->pack(-side => 'top', -fill => 'x'); my $descriptionrow4 = $row4->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 9, -padx => 8); my $t4 = $descriptionrow4->Label(-text => 'Serial Number ', -background => 'cyan',)->pack(); $t4 = $descriptionrow4->Label(-text => 'Part Number', -background => 'cyan',)->pack(); $t4 = $descriptionrow4->Label(-text => 'Status', -background => 'cyan',)->pack(); #################### Row 4 Frame #################### #################### Slot 13 #################### my $slot13 = $row4->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot13 = $slot13->Label(-text => 'Slot 13', -background => 'cyan')->pack(); my $sernumSlot13 = $slot13->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[13], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot13 = $slot13->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[13], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot13 = $slot13->Label(-text => '13dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot13 = $slot13->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 13 #################### #################### Slot 14 #################### my $slot14 = $row4->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot14 = $slot14->Label(-text => 'Slot 14', -background => 'cyan')->pack(); my $sernumSlot14 = $slot14->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[14], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot14 = $slot14->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[14], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot14 = $slot14->Label(-text => '14dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot14 = $slot14->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 14 #################### #################### Slot 15 #################### my $slot15 = $row4->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot15 = $slot15->Label(-text => 'Slot 15', -background => 'cyan')->pack(); my $sernumSlot15 = $slot15->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[15], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot15 = $slot15->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[15], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot15 = $slot15->Label(-text => '15dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot15 = $slot15->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 15 #################### #################### Slot 16 #################### my $slot16 = $row4->Frame(-background => 'cyan',)->pack(-side => 'left', -pady => 2, -padx => 15); my $descSlot16 = $slot16->Label(-text => 'Slot 16', -background => 'cyan')->pack(); my $sernumSlot16 = $slot16->Entry(-width => 22, -background => 'white', -textvariable => \$sernums[16], -validate => 'focusout', -validatecommand => \&validateSerNum, -invalidcommand => \&invalidSerNum)->pack(); my $partnumSlot16 = $slot16->Entry(-width => 22, -background => 'white', -textvariable => \$partnums[16], -validate => 'focusout', -validatecommand => \&validatePartNum, -invalidcommand => \&invalidPartNum)->pack(); my $statusSlot16 = $slot16->Label(-text => '16dormant', -background => 'white', -width => 19, -relief => 'groove', -borderwidth => 3)->pack(-anchor => 'center'); my $goSlot16 = $slot16->Button(-width => 10, -height => 1, -text => 'Start', -background => 'gray', -command => \&compute)->pack(-side => 'top', -anchor => 'center'); #################### End Slot 16 #################### $main->geometry('+400+200'); # '+10+340' &compute(); $status->configure(-text => "Status Display"); $statusSlot1->configure(-text => "Inactive", -background => 'gray'); $statusSlot2->configure(-text => "Inactive", -background => 'gray'); $statusSlot3->configure(-text => "Inactive", -background => 'gray'); $statusSlot4->configure(-text => "Inactive", -background => 'gray'); $statusSlot5->configure(-text => "Inactive", -background => 'gray'); $statusSlot6->configure(-text => "Inactive", -background => 'gray'); $statusSlot7->configure(-text => "Inactive", -background => 'gray'); $statusSlot8->configure(-text => "Inactive", -background => 'gray'); $statusSlot9->configure(-text => "Inactive", -background => 'gray'); $statusSlot10->configure(-text => "Inactive", -background => 'gray'); $statusSlot11->configure(-text => "Inactive", -background => 'gray'); $statusSlot12->configure(-text => "Inactive", -background => 'gray'); $statusSlot13->configure(-text => "Inactive", -background => 'gray'); $statusSlot14->configure(-text => "Inactive", -background => 'gray'); $statusSlot15->configure(-text => "Inactive", -background => 'gray'); $statusSlot16->configure(-text => "Inactive", -background => 'gray'); MainLoop(); sub compute { return; } sub validateSerNum { my $sernum = shift; print "validateSerNum called with $sernum\n"; if (($sernum =~ m/^\d{8}/) && (length($sernum) == 8)) { print "Returning 1\n"; return(1); } else { print "Returning 0\n"; return(0); } } sub invalidSerNum { $main->bell; $main->messageBox(-icon => 'error', -message => 'Serial number must be 8 digits!', -title => 'Error', -type => 'Ok'); $main->focusCurrent; } sub validatePartNum { my $partnum = shift; print "validatePartNum called with $partnum\n"; if (($partnum =~ m/^\d{8}/) && (length($partnum) == 8)) { print "Returning 1\n"; return(1); } else { print "Returning 0\n"; return(0); } } sub invalidPartNum { $main->bell; $main->messageBox(-icon => 'error', -message => 'Invalid part number!', -title => 'Error', -type => 'Ok'); $main->focusCurrent; }