Notifications
Clear all

[Closed] Adding to an existing MultiListBox

Hi guys,

I am pretty new to max scripting but i am somewhat competent in python and more so in MEL. I was trying to use a button to add items to a multlist box in the same rollout but seem to have hit a wall, in the maxScript help it doesnt show that i actually can edit them. Just was wondering if there were any quick solutions to this little problem, i can think of how i would do it in MEL so my brain is convinced that there must be a way to do it here…

here is the code im using right now:

rollout ExpButtons “Set Buttons”

( button yup “OK” across:5 width:80 align:#left
button Cancel “Cancel” across:5 width:80 align:#left
button NewFile “NewFile” across:5 width:80 align:#left
button RemoveFile “Remove File” across:5 width:80 align:#left
button CopyFrom “Copy From” across:5 width:80 align:#left

  on NewFile pressed do
  ([indent]         curSets = sets.setList.items

)
[/indent])

rollout sets “Sets” (

MultiListBox setList “Exporter Sets” items:#(“default”)

on setList doubleclicked val do

(

  format "doubleclicked: % - %

” val setList.selection[val]

  rollout newSet "Set" height:500 width:500
      (         button yo "yo" across:2 width:80 align:#left

[indent] on yo pressed do
(
messagebox “work”
)
)[indent] createDialog newSet “Set”
)
[/indent][/indent]

)

ExportUI = newRolloutFloater “Export UI WIP” 500 400

addRollout sets ExportUI
addRollout ExpButtons ExportUI

2 Replies

Please read the topic “How do I update the items in a dropdownList or listBox?” in the MAXScript Help.

It shows the basics.

The main difference in a multiListBox is that its .selection property is a bitarray and not an integer, but the example in the help should point you in the right direction.

In general, you can deal with the .items array of elements as with a regular array, use deleteItem(), append(), findItem() etc. functions to find stuff. Going through a temp. array is a good idea.

awesome thanks, yeah i got that part to work, that page helped out alot…

sets.setList.items = append(sets.setList.Items) (setName.text)

Thanks