|
Post by mrtatoad on Feb 1, 2009 13:47:05 GMT -5
selection() for LISTBOX seems to just return 0, no matter what item you select.
selection$() though returns the correct string
|
|
|
Post by StefanPendl on Apr 9, 2009 2:03:55 GMT -5
Below find an example of what is actually returned by the SELECTION() method.
Instead of returning the positional index of the item, it returns the numerical value of the contents.
Index = #list selection() is actually Index = val(#list selection$())
dim list$(20) dim items$(20)
for i = 1 to 20 list$(i) = "Item "; i; "." items$(i) = ""; i + 20; ". Item" next
[display] cls listbox #list, list$(), 1 print " ... you selected ... "; ListSelection$; " ... Index "; ListIndex #list select(ListSelection$) print listbox #item, items$(), 1 print " ... you selected ... "; ItemSelection$; " ... Index "; ItemIndex #item select(ItemSelection$) print button #bt, "Check Selections", [check] wait
[check] ListSelection$ = #list selection$() ListIndex = #list selection()
ItemSelection$ = #item selection$() ItemIndex = #item selection() goto [display] end
|
|