Swapping elements from one list box to other list box. I have a code like this.
$lab2 = $frm_name -> Label(-text=>"Selected Files: ",-foreground=>'black',-fo
nt => ['Times New Roman', '14'])->place( -x =>260, -y => 100);
my $lst2 = $frm_name->Scrolled('Listb
ox',-font => ['Times New Roman', '10'],-height=>'8',-scroll
bars => 'se',-selectmode => 'single',
-width=>'25')->place( -x => 260, -y =>120);
$lab = $frm_name -> Label(-text=>"Files List: ",-foreground=>'black',-fo
nt => ['Times New Roman', '14'])->place( -x =>30, -y => 100);
my $lst = $frm_name->Scrolled('Listb
ox',-font => ['Times New Roman', '10'],-height=>'8',-scroll
bars => 'se',-selectmode => 'single',
-width=>'25')->place( -x => 30, -y =>120);
@array = &Code_Changes();
$lst -> insert('end',@array);
$lst->bind('<Double-1>', \&give_color);
$lst->bind('<Triple-1>', \&remove_color);
sub give_color
{
$lst->itemconfigure('activ
e',-foregr
ound => 'red');
$lst->selectionClear('acti
ve');
}
sub remove_color
{
$lst->itemconfigure('activ
e',-foregr
ound => 'black');
}
$but5 = $frm_name -> Button(-text=>">",-font => ['Times New Roman', '14'],
sub display
{
my @selected;
my $index;
for($index=0,$i=0;$index<$
lst->size;
$index++)
{
$color2 = $lst->itemcget($index,-for
eground);
if($color2 eq 'red')
{
@selected[$i] = trim($lst->get($index));
$i++;
}
}
$lst2 -> insert('end',@selected);
}
-command => \&display)->place( -x =>217, -y =>140);
Start Free Trial