antonv
11-20-2005, 05:10 AM
Hello everybody,
I'm trying to display the selected item in the listbox in a label but seems like there is an issue with the way multilistbox handles the selection of it's items!
Here is a sample code that gives the error:
mlbItems = #("A","B","C","D","E","F","G")
rollout test "test"
(
MultiListBox mlb "MultiListBox" selection:mlbItems.count items:mlbItems
label lbl "selection"
on mlb selected nameindex do
(
format "%\n" ((mlb.selection as array)[1] as string)
lbl.text = mlb.items[(mlb.selection as array)[1]]
)
)
createdialog test 200 200
When the rollout is created, the selected item is the last in the listbox. In the listener you'll see that the format command displays 2 values each time you change the selection! If you select towards the first item, everything works ok but in the moment you go back towards the last one, the script crashes because one of the values returned by the listbox is "undefined"!
Is there something that I'm missing or doing wrong here? Did anybody else encountered this before?
I'm trying to display the selected item in the listbox in a label but seems like there is an issue with the way multilistbox handles the selection of it's items!
Here is a sample code that gives the error:
mlbItems = #("A","B","C","D","E","F","G")
rollout test "test"
(
MultiListBox mlb "MultiListBox" selection:mlbItems.count items:mlbItems
label lbl "selection"
on mlb selected nameindex do
(
format "%\n" ((mlb.selection as array)[1] as string)
lbl.text = mlb.items[(mlb.selection as array)[1]]
)
)
createdialog test 200 200
When the rollout is created, the selected item is the last in the listbox. In the listener you'll see that the format command displays 2 values each time you change the selection! If you select towards the first item, everything works ok but in the moment you go back towards the last one, the script crashes because one of the values returned by the listbox is "undefined"!
Is there something that I'm missing or doing wrong here? Did anybody else encountered this before?
