riz has asked for the wisdom of the Perl Monks concerning the following question:

Dear Perl Gurus,
Somebody help here with Tk.

$lbl = left hand side listbox.
$lbr = right hand side listbox.
singleItemSelect() = callback for a button that should bring the selected items from left to right listbox.

I've tried get() 7 see() but only the index (integer) is transferred not the string. How should I make the statement below? What is missing?

Many thanks.
riz.

sub singleItemSelect{
@selectedItemIndex = $lbl->curselection();
foreach (@selectedItemIndex)
{
# $lbr->get(0, "end");
# $lbr->see($_);
}
}

Replies are listed 'Best First'.
Re: Display of listbox items from index
by thundergnat (Deacon) on Jun 14, 2005 at 11:01 UTC

    It isn't very clear from your question exactly what you are trying to do. I am going to assume that you want the selected items from a populated listbox to be inserted into an empty listbox. Once it is stated that way, the answer should be somewhat obvious.

    sub singleItemSelect{ my @selectedItemIndex = $lbl->curselection; for (@selectedItemIndex) { $lbr->insert('end', $lbl->get($_)); } }
      It worked!
      thanks for the help.
      riz.