How to iterate through list widget

Discuss your Lua playlist, album art and interface scripts.
147852369
Blank Cone
Blank Cone
Posts: 55
Joined: 01 Mar 2013 12:18

How to iterate through list widget

Postby 147852369 » 07 Oct 2014 20:28

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

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: How to iterate through list widget

Postby mederi » 08 Oct 2014 10:59

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.

147852369
Blank Cone
Blank Cone
Posts: 55
Joined: 01 Mar 2013 12:18

Re: How to iterate through list widget

Postby 147852369 » 10 Oct 2014 14:49

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.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 13 guests