Notifications
Clear all

[Closed] Updating display of multiListBox

Hi, I’m trying to update the display of a Maxscript multiListBox, but the results are not what I expected. When multiListBox items are cleared/deleted, the display of multiListBox doesn’t visually update, so it still appears the list has x number of items, when it actually has none. What’s the solution? Thanks in advance!

I’ve included code to demonstrate what I mean…

try(destroyDialog testMlb)catch()
appName = “Test Code”

fn clearValues thisMultiList =
(
print “Reset MultiListBox…”
counter = 0
for count = thisMultiList.items.count to 1 by -1 do
(
deleteItem thisMultiList.items count
counter += 1
)
print (“Deleted items=” + counter as string)
print (“mlb size=” + thisMultiList.items.count as string)
)

fn setValues thisMultiList thisValue endCount =
(
print “Creating MultiListBox…”
counter = 0
for count = 1 to endCount do
(
arrayValue = count + thisValue
thisMultiList.items = append thisMultiList.items (“[” + arrayValue as string + “] “)
counter += 1
)
print (“Created items=” + counter as string)
print (“mlb size=” + thisMultiList.items.count as string)
)

rollout testMlb appName
(
group “”
(
multilistbox mlb_browser
button bt_setValues “Set Values” align:#center
spinner spin_amount “Amt: ” range:[1,32,0] type:#integer align:#center
button bt_clearValues “ClearValues” align:#center
)

on bt_setValues pressed do
(
	setValues mlb_browser spin_amount.value 4
)

on bt_clearValues pressed do
(
	clearValues mlb_browser
)

)

createDialog testMlb 350 250 495 86

3 Replies

Your multiListBox items are actually cleared at this point.
All you need to do to visually clear the list is to give your multiListBox “thisMultiList” an empty array like this:

thisMultiList.items = #()

Perfect! Many thanks.

Excellent. Thank you!