Asking a question is harder than I hoped. The solution above solved my problem; curselection was the magic word. It has only one problem: If the list has 1 item if ( $lb1->curselection ) {
will be false. I changed it to if ($lb1->curselection)>=0 ) {
but this generates an error message when the listbox is not selected. For the rest it works fine.