Hi,

I use
-multisel => 2
option in Listbox properties
to allow multiple selection  ehnanced (with Shift, Control, etc.)
But I can not remove all selected items. I can remove only either 
one item at a
time or some of selected items but not all.
For example If I select item 1,3,and 4,
items 1 and 4 are deleted, but  not 3.

 There is either a bug or there si something wrong in my program.
Does anyone have a similar experience?
The program I use is below.
Could you please have a look at that program below?
Thank you very much for help.

###############
use Win32::GUI;

$W = new GUI::Window(
    -title    => "Win32::GUI::Listbox text",
    -left     => 100,
    -top      => 100,
    -width    => 360,
    -height   => 210,
    -style    => 1024 | WS_BORDER | WS_CAPTION | 
WS_SYSMENU,
    -name     => "Window",
) or print_and_die("new Window");


$List2 = $W->AddListbox(
    -name => "List2",
   -style => WS_VISIBLE | WS_VSCROLL | 3 | WS_TABSTOP,
    -left => 250,
    -top  => 5,
    -height => 120,
    -menu => 2,
    -tabstop => 1,
    -group => 1,
    -width => 100,
-multisel => 2,
 -sort     => 1
);

$List2->AddString("Item 0 ");
$List2->AddString("Item 1");
$List2->AddString("Item 2");
$List2->AddString("Item 3");
$List2->AddString("Item 4");

$List2->Select(0);

$Remove = $W->AddButton(-text  => "<< Remove",
                           -left  => 125,
                           -top   => 95,
                           -width => 100,
                           -menu  => 6,
                           -name  => "Remove") or print_and_die("new
Button");


$Close = $W->AddButton(-text  => "Close",
                       -left  => 250,
                       -top   => 150,
                       -width => 100,
                       -name  => "Close") or print_and_die("new
Button");




$W->Show;

$return = $W->Dialog();


sub Remove_Click {

foreach $i ($List2->SelectedItems())
{
$List2->Select($i);
$List2->RemoveItem($i);
print "Chosen $i,";
}
print "\n";
   return 1;

}

sub Close_Click
{
return -1;
}


I look forward to hearing from you soon.

Best Regards,

Ladislav Blazek
Czech Republic
Tel/Fax +420 506 418253
Mobile: +420602 849309
email1: [EMAIL PROTECTED]
email2: [EMAIL PROTECTED]


Reply via email to