#!/usr/local/bin/perl use Tk; use Tk::ROText; use Tk::Text; use Tk::Balloon; use Tk::Listbox; use Tk ':eventtypes'; use strict; use lib "."; use lib 'J:\\myWebPage\\WPMC\\files\\DB\\'; use walk_locations; my %walkLoc = walk_locations->new(); use vars qw($inFile $outFile $formHandler); my $main = MainWindow->new(); $main->configure (-title=>'WPMC Walk List'); my $topFrame = $main->Frame (-relief=>'sunken', -borderwidth=>1); my $lftFrame = $main->Frame (-relief=>'sunken', -borderwidth=>1); my $midFrame = $main->Frame (-relief=>'sunken', -borderwidth=>1); my $rgtFrame = $main->Frame (-relief=>'sunken', -borderwidth=>1); my $botFrame = $main->Frame (-relief=>'sunken', -borderwidth=>1); my $butFrame = $botFrame->Frame (-label=>'', -relief=>'raised', -borderwidth=>1); $topFrame->pack(-side=>'top', -anchor=>'w', -fill=>'both'); $lftFrame->pack(-side=>'top', -anchor=>'e', -fill=>'both'); $midFrame->pack(-side=>'top', -anchor=>'center', -fill=>'both'); $rgtFrame->pack(-side=>'top', -anchor=>'w', -fill=>'both'); $botFrame->pack(-side=>'bottom', -anchor=>'w', -fill=>'both'); $butFrame->pack(-side=>'left', -anchor=>'w', -fill=>'both'); ### # submit/exit buttons ### my @button; $button[0] = $butFrame->Button(-text=>'Submit', -command=>\&submit, -fg=>"darkgreen", -background=>"ivory", -activebackground=>'lightgreen'); $button[1] = $butFrame->Button(-text=>'Exit', -command=>sub{exit}, -fg=>"darkred", -background=>"ivory", -activebackground=>"indianred"); $button[2] = $butFrame->Button(-text=>'Help', -command=>[\&help], -fg=>"orange", -activebackground=>"wheat", -background=>"ivory"); $button[0]->pack(-side=>'right', -anchor=>'e', -fill=>'none'); $button[1]->pack(-side=>'right', -anchor=>'e', -fill=>'none'); $button[2]->pack(-side=>'right', -anchor=>'e', -fill=>'none'); # Create the balloon widget my $b = $butFrame->Balloon(-statusbar => my $status); $b->attach($button[0], -msg => 'Create e-mail list'); $b->attach($button[1], -msg => 'Exit This Program'); $b->attach($button[2], -msg => 'General Help Screen'); # Listbox my $label1 = $midFrame->Label(-text => "By Location", -anchor => 'e')->pack(-side=>'left' ); my $listbox = $midFrame->Listbox(-fg=>"darkblue", -background=>"ivory", -height=>-1)->pack(-side=>'left'); getList (my @list); $listbox->insert('end', @list ); $listbox->selectionSet(1); #$listbox->curselection my $label2 = $topFrame->Label(-text => "Distance")->pack(); my $distance = $topFrame->Entry(-fg=>"darkblue", -background=>"ivory")->pack(); my $label6 = $topFrame->Label(-text => "City")->pack(); my $city = $topFrame->Entry(-fg=>"darkblue", -background=>"ivory")->pack(); my $label7 = $topFrame->Label(-text => "State", -anchor => 'center')->pack(); my $state = $topFrame->Entry(-fg=>"darkblue", -background=>"ivory")->pack(); my $label3 = $topFrame->Label(-text => "Zip Code", -anchor => 'center')->pack(); my $zipCode = $topFrame->Entry(-fg=>"darkblue", -background=>"ivory")->pack(); my $label4 = $topFrame->Label(-text => "Latitude", -anchor => 'center')->pack(); my $latitude = $topFrame->Entry(-fg=>"darkblue", -background=>"ivory")->pack(); my $label5 = $topFrame->Label(-text => "Longitude", -anchor => 'center')->pack( ); my $longitude = $topFrame->Entry(-fg=>"darkblue", -background=>"ivory")->pack(); #defauts $distance->insert('end', '15'); #Geometry Management $label2 -> grid(-row=>1,-column=>1); $distance -> grid(-row=>1,-column=>2,-sticky=>"ns"); $zipCode -> grid(-row=>2,-column=>6,-sticky=>"ns"); $longitude -> grid(-row=>3,-column=>4,-sticky=>"ns"); print "@ main loop\n"; #MainLoop; while (MainWindow->Count) { print MainWindow->Count,"\n"; DoOneEvent(ALL_EVENTS); #$MainWindow->update(); } sub submit () { my %args; my $hash; my $key; my $value; my $argv; $args{distance}{value} = $distance->get(); $args{city}{value} = $city->get(); $args{state}{value} = $state->get(); $args{zipCode}{value} = $zipCode->get(); $args{latitude}{value} = $latitude->get(); $args{longitude}{value} = $longitude->get(); $args{distance}{argv} = "-distance="; $args{city}{argv} = "-city="; $args{state}{argv} = "-state="; $args{zipCode}{argv} = "-zip="; $args{latitude}{argv} = "-latitude="; $args{longitude}{argv} = "-longitude="; print "--------------------------------------\n$args{distance}{value}\n"; my $argString = ""; while ( ($key, $hash) = each %args ) { print "-->{$key}: \n"; while ( ($argv, $value) = each %$hash ) { print "inside $argv\n"; if ($value=~/\s*/==1) { print "true value = ".$value."\t". $value=~/\s*/==1,"\n";} elsif ($value=~/\s*/!=1) { print "false value = ".$value."\t". $value=~/\s*/==1,"\n";} else { print "fail all\n";} } print "\n"; } #print 'perl.exe "J:\myWebPage\WPMC\files\DB\zip.pl" '.$argString; } sub help () { ; } sub getList (@) { ### # Walk locations ### my $key; my $value; while (($key, $value) = each(%walkLoc)) { push (@list, $key);} }