Page 1 of 1

How to iterate through list widget

Posted: 07 Oct 2014 20:28
by 147852369
Hello community,

how can I iterate through a list widget (all items or all selected in there), which I implemented this way:

Code: Select all

ir = ir + 1; -- incremented d = vlc.dialog("My new extension") deleteListGUI = d:add_list(1,7,10,10) deleteListGUI:add_value("string", ir) -- how to iterate through deleteListGUI?
edit:

Code: Select all

-- remove selected items from delete-list function removeFromDeleteList() local selected = deleteListGUI:get_selection() for name, value in pairs(selected) do vlc.msg.dbg("name: " .. name .. " value: " .. value) deleteListGUI:add_value("", name) -- overwrite, want to delete d:update() -- but the overwritten item is already seen in the list and another empty item appends to the list -- I want to delete these value's from deleteListGUI but keep the unselected items in this list end end -- how looks the function to get all items in deleteListGUI? function getAllItemsInList() -- ??? end

Re: How to iterate through list widget

Posted: 08 Oct 2014 10:59
by mederi
w:clear(): Clear a list or drop_down widget. After that, all values previously added are lost.
You have a table (array) of items listed in a list widget. Then parse a selection and delete all selected items in the table. Then clear the list widget and list items of the modified table.

Re: How to iterate through list widget

Posted: 10 Oct 2014 14:49
by 147852369
You're right. This is a good idea. Thanks. If there was more list widget functions the performance was better. Now I always have to update the list, clear the guiList and go through (for) the updated list and add all values into the guiList again.