PDA

View Full Version : Get selected items of a multilist ctl



ernpchan
11-13-2014, 05:28 PM
How can I get the selected items from a mutilist_ctl?

In lscript I would use getvalue on the item control. Not sure what the equivalent is in python.

clintonman
11-13-2014, 05:50 PM
There's a sample in the python generic folder.
Here's the path on my machine.
"C:\Program Files\NewTek\LightWave11.6.3\support\plugins\scrip ts\Python\Layout\Generic\multilist_test.py"

ernpchan
11-13-2014, 05:58 PM
Thanks. I actually have that open in notepadd++ but it's using set_select. What I want to do is get the selection only after I've hit an 'Execute' button. I'm not trying to get it after each item click.

I could do .get_int() on my control item, but that only gives me the last selected item. Trying to figure out how to get the selected indexes as an array. At least that's how it works in lscript.

clintonman
11-13-2014, 07:39 PM
I don't think it works that way. I think it only gives a selected item one at a time as you click it.
c1.set_select(self.multi_select_event_func) tells it to call the multi_select_event_func function whenever a selection is made.
I also think there's a bug because the selecting value is always true in the function, so deselect never happens.

ernpchan
11-13-2014, 08:01 PM
I'll submit a bug report. See what they say cuz my script works in lscript but I need to convert it to python to take advantage of stuff in python that's not in lscript.