PDA

View Full Version : A new thing in multilistbox name retrieve


akesh.kulmi
01-30-2006, 09:16 AM
--------------------------------------------------------------------------------

hi all

last week i asked about how to get back names in multilistbox ie by converting bitarray to array


now iam stuck with a great problem

1. i wanna retrieve name from multilist as they are selected like if first i selct 7th element from the list and then selcted 4th
now i wanna these name to be ike ex sphere07 and then sphere04 as the choice of selection is important ...

2. and i also wanna retrieve there index no (7,4) not (4,7) how it can be done
iam also giving that code where iam using this


fn morph_index morpherList0=
(
Morsel = for i in morpherList0.selection collect morpherList0.items[i] -- used to collect the names of seelcted elements
morselindex=for j in morpherList0.selection collect morpherList0.selection as array
x=morselindex.count
if x==1 then --selecting first item it can be anyone fromlist
(


namearr= for x in morpherList0.selection collect morpherList0.items[x] -- as first is selcted it shows its name

indexarr[1]=morpherList0.selection[1]



)
else if x ==2 then --selecting 2nd it also can be any one fromlist
(

namearr[2]= for x in morpherList0.selection collect morpherList0.items[x] -- as we are selecting 2 it shows names of both but i waana name of 2nd selected only

indexarr[2]=morpherList0.selection[2]-- for capturing index

)

)

---- this two things name with corresponding index no is required as iam using it in wiring two morph targets

-- iam firing this function in multilist
ex.
on morpherList0 selected i do
(
morpharr1=morpherList0.items ---- for second list

mor_num1=morpherList0.selection
Morsel = for i in morpherList0.selection collect morpherList0.items[i] -- used to collect the names of seelcted elements
morselindex=for j in morpherList0.selection collect morpherList0.selection as array
-- used for taking names of selected objs
morph_index morpherList0


)


i need this very urgently as iam doing scripting for sliders.........

Bobo
01-30-2006, 02:10 PM
--------------------------------------------------------------------------------

hi all

last week i asked about how to get back names in multilistbox ie by converting bitarray to array


now iam stuck with a great problem

1. i wanna retrieve name from multilist as they are selected like if first i selct 7th element from the list and then selcted 4th
now i wanna these name to be ike ex sphere07 and then sphere04 as the choice of selection is important ...

2. and i also wanna retrieve there index no (7,4) not (4,7) how it can be done
iam also giving that code where iam using this





Here is a general example - pick it apart and modify your own.
It stores the indices of the selected items IN THE ORDER OF SELECTION in the user array lastSelection:


(
rollout test "Test"
(
local lastSelection = #()
multilistbox mlb_select items:#("One","Two","Three")
on mlb_select selectionEnd do
(
newSelection = mlb_select.selection as array
for i = 1 to newSelection.count where findItem lastSelection newSelection[i] == 0 do
append lastSelection newSelection[i]
for i = lastSelection.count to 1 by -1 where findItem newSelection lastSelection[i] == 0 do
deleteItem lastSelection i
format "%: %\n" lastSelection (for i in lastSelection collect mlb_select.items[i])
)--end on
)--end rollout
createDialog test
)--end script

CGTalk Moderation
01-30-2006, 02:10 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.