sub guiStart { my ($client,$login) = @_; my $mw = MainWindow->new(-borderwidth=>30, -title=>"Duplicates: ".$$client); my %layout = ('frame' => [], 'label' => [], 'callback'=> []); #Construct labels $layout{'label'}->[0] = 'List Available Data'; $layout{'label'}->[1] = 'Remove Data'; $layout{'label'}->[2] = 'Add Data'; $layout{'label'}->[3] = 'Identify Duplicates'; $layout{'label'}->[4] = 'Change Client'; $layout{'label'}->[5] = 'Exit Application'; #Set callbacks $layout{'callback'}->[0] = [\&listData,$client,$login,$mw]; $layout{'callback'}->[1] = [\&removeData,$client,$login,$mw]; $layout{'callback'}->[2] = [\&addData,,$client,$login,$mw]; $layout{'callback'}->[3] = \&identifyDuplicates; $layout{'callback'}->[4] = \&changeClient; $layout{'callback'}->[5] = \&exitApp; for (0..5) { #Create the frames $layout{'frame'}->[$_] = $mw->Frame(); #Create the buttons $layout{'frame'}->[$_]->Button(-text =>$layout{'label'}->[$_], -width =>20, -command=>$layout{'callback'}->[$_])->pack(); $layout{'frame'}->[$_]->pack(); } MainLoop; return; } #### sub removeData { my ($client,$login,$mw) = @_; my @tapes = getTapes($client,$login); #Create a DialogBox my $dlg = $mw->DialogBox(-title =>"Delete tape for: ".$$client, -buttons =>['Delete','Cancel'], -borderwidth=>5); my $list = $dlg->Scrolled('Listbox', -scrollbars=>'oe os', -background=>'black', -foreground=>'white', -height =>12, -width =>12)->pack(); $list->insert('end',$_) for @tapes; my $choice= $dlg->Show(); my $num = $list->get($list->curselection()); #If the user chose Delete if(lc($choice) eq 'delete') { #Drop the listbox $list->packForget(); #Reconfigure the dialog title $dlg->configure(-title =>'Delete Confirmation!'); #Reconfigure the dialog button text $dlg->Subwidget('B_Delete')->configure(-text=>'Yes'); $dlg->Subwidget('B_Cancel')->configure(-text=>'No'); $dlg->Label(-text=>"Tape:".$num." will be deleted. Are you sure?")->pack(); if(lc($dlg->Show()) eq 'yes') { my $success = deleteTape($client,\$num,$login); } } return; }