Selecting in listboxes


New member
I am having a strange issue that I can’t figure out. I have my script that finds references to an item in the scene file and presents a listbox to the user with the items that are affected. I want to uses an event UDF to let the user select an item from the listbox. However I can’t seem to get it to produce an array index that is valid.

It seems to do so, and if I put an info() in the udf pointing to the array index it spits out the correct integer, but I can’t for the life of me use that integer with the array of objectIDs that I have. I have checked that the object ID array is correct inside the event udf, and it is, and I Have a check so that it only tries to select the item if the Index from the listbox isn’t nil.

Any ideas?


No sure to follow you without your code,
afaik the returned selection of ctllistbox is an array of selected indexes,

a = getvalue(c1);

b = a;//get each selected index and use it for your need



New member
Can getvalue() be used on a listbox? I have used that for things like ctlpopup but I didn’t know that I could for a listbox. I will see if I can get that to work. If not, I will happily share my poorly commented amateurish code if you are willing to take a look.


New member
I got it to work, thanks!

I think what was confusing me was that the listbox was spitting out an array of indexes. i would use the info() function to see what value it was spitting out, and it would show me an integer, that was the index of the selection. i wasn't selecting multiple items so didn't realize that i was looking at an array of indexes that was only one index large.
Top Bottom