January 1999
Beginner
373 pages
9h 43m
English
The get method returns a list of listbox elements specified by the indexes first to last:
$lb->get(firstindex [, lastindex ]);
If only the firstindex is specified, only one element is returned. The firstindex must be less than or equal to the lastindex. To get a list of all elements in the listbox:
@elements = $lb->get(0, 'end');
To get the last item in the listbox:
$lastitem = $lb=>get('end');
To find out which items in the listbox are selected, use the curselectionmethod:
@list = $lb->curselection();
It returns a list containing the indexes of all currently selected items in the listbox. If no items are selected, curselection returns an empty string. Here is an example of how the curselectionmethod is used:
@selected = $lb->curselection;
foreach (@selected) {
# do something with the index in $_
}
Make sure to remember that curselection returns a list of indexes, not elements.