Hi monks , I am facing the problem while getting the element from the list box , whenever i gave a double click on the item its going some where else ,please help me how to get an element from the list box , when i pressed double click on the item.
#!/usr/bin/perl -w
use Tk;
use Tk::LabFrame;
$mw = MainWindow->new;
#$mw -> configure(-background => 'cyan',
## -foreground => 'white');
$mw -> geometry ("400x400+100+120") ;
$mw -> CmdLine;
my $chk = 0;
my $var;
$f1 = $mw -> LabFrame(-label=> "Select one Test",-font=> 'ukai',-label
+side => "acrosstop")->pack();
my $s300 = $f1->Radiobutton(-text=>"TEST1",-value=>"do_1",-indicator=>
+1,-variable=>\$chk,-font=>'ukai 11',-command=>\&do_1)->pack();
$s300->configure(-state);
my $s310 = $f1->Radiobutton(-text=>"TEST2",-value=>"do_2",-indicator=>
+1,-variable=>\$chk,-font=>'ukai',-command=>\&do_2)->pack();
$s310->configure(-state);
$f1 -> place ( -x => 40 , -y => 50, -width=>"140", -height => "100" );
$f2 = $mw -> LabFrame(-label => "Selet One",-font=> 'ukai',-labelside
+=> "acrosstop")->pack();
my @INP_List = (qw/TES0 TES1 TES2 TES3 TES4 TES5 TES6 TES7 TES8 TES9/)
+;
$lb = $f2 -> Scrolled("Listbox", -scrollbars => "e",-selectmode => "ex
+tended",-font=> 'ukai',-activestyle => "dotbox")->pack();
$lb -> bind('<Double-1>'=> sub {
$_[0]->setpalatte($_[0]->get('active')
+);
},
);
$lb->bind('<Up>',sub {move_cursor_up();});
$lb->bind('<Down>',sub {move_cursor_down();});
$lb->bind('<Return>',sub {enter_press();});
$f2 -> place ( -x => 220 , -y => 50, -width =>"160", -height => "80");
MainLoop;
sub do_1 {
if ($chk eq "do_1" ) {
$lb->delete(0,'end');
@GUI_List = @INP_List[0,1,2,3,4];
$lb->insert('end',@GUI_List);
print "@GUI_List\n";
}
}
sub do_2 {
if ($chk eq "do_2") {
$lb->delete(0,'end');
@GUI_List = @INP_List[5,6,7,8,9];
$lb -> insert('end', @GUI_List);
print "@GUI_List\n";
}
}