Subject: | -selected option on -multi Listbox doesn't function as documented |
Perl Version: perl 5.8.0
Distribution version: Curses::UI 0.92
OS: RedHat Linux 9
I have found that the -select option in -multi listbox does not work as documented. According to my understanding of the documentation, to have multiple boxes selected in a multiple select Listbox, one must pass the -selected option with a hash reference with keys containing the -values which should be selected, the value of these entries being true. I tested the function using the example demo-widgets code, modified as follows:
diff demo-widgets.orig demo-widgets.changed
375a376
Show quoted text
> my $selected = {"1"=>1,"2"=>1,"3"=>1};
382a384
Show quoted text> -selected => $selected,
According to the documentation, one would expect the entries for 1, 2, and 3 in this listbox would have an "X" indicating that they are selected. Instead, I found that entries 2,3,and 4 were selected. It appears that instead of using the hash key to determine which -values record entry is selected, the hash key is really selecting the corresponding array index from the -values array reference. This makes it hard to work with arbitrary data in a multi-selected Listbox.