|
Just wondering if anyone knows how a multiListBox can be implemented in a scripted plugin.
I can’t see any way of linking the rollout ui item to a parameter, like most other parameters in a plugin.
If I do it manually, it seems there is some sort of global variable that holds the selection list for the multiListBox and is only additive. eg
plugin helper tester
name:"tester"
category:"tester"
classID:#(0x3d3f8c7a, 0x470fa330)
extends: point
replaceUI: true
version: 2
(
local someNumber = 1
local selectionList = #(0)
rollout testRollout "Test"
(
multilistbox testList "test" items: #("item1","item2","item3","item4") selection: selectionList
on testList selectionEnd do
(
selectionList = testList.selection as array
)
Spinner aNumber "aNumber:" type:#integer range:[0,100,someNumber]
on aNumber changed arg do
(
someNumber = arg
)
)
)
If we create two objects of this type. On the first object we select ‘item1’. When we go to the second object ‘item1’ will be selected already (confirmed with $.testRollout.testList.selection) if we then selected ‘item3’ then and go back to the first object, we see that both ‘item1’ and ‘item3’ are now selected.
We can correct the selection by doing something like;
$.testRollout.testList.selection = $.selectionList
If we delete both those objects and go to create a new one, both those items will still be selected. So it seems there must be a global rollout (or maybe just the multiListBox) object which is shared between the plugin objects. When the selection set on that is set, it must just add the selection rather than setting the rest to unselected then adding the selection.
Any ideas on a workaround? or am I missing something obvious?
|