Skip to content

Lua extensions: selected item API for dialog dropdown widget

I have written following VLC extension script: Time. There is a [ >> PUT IN ] button that puts a selected text from drop-down list into the input field above and should also set the first empty item in drop-down list. This setting works while initiating dialog box also in VLC2 - please see the third option "top-right" in position drop down list there. VLC 1.1.10 works well with that. There has been made some changes in VLC 1.1.11 disabling this behaviour.

Here I have prepared a short extension script to test a drop-down widget:

-- "test dropdown widget.lua" --

function descriptor()
    return {title = "test dropdown widget"}
end
function activate()
  create_dialog()
end
function deactivate()
end
function close()
	vlc.deactivate()
end

function create_dialog()
	w = vlc.dialog("test dropdown widget")
	w1 = w:add_dropdown(1,1,1,1)
		w1:add_value("one", 1)
		w1:add_value("two", 2)
		w1:add_value("three", 3)
		w1:add_value("four", 4)
			w1:set_text("three")  -- <<< I suggest to use w1:set_text(3)
	w2 = w:add_button("Set to TWO", click_TWO,1,2,1,1)
end

function click_TWO()
	vlc.msg.info("[test dropdown widget] get_text: " .. w1:get_text())
	vlc.msg.info("[test dropdown widget] get_value: " .. w1:get_value() .. "\n")
	w1:set_text("two")  -- w1:set_text(2)
	w:update()
end

Dear developers, I would like to ask you to test a behaviour of this script in VLC 1.1.10 and VLC2 and to tell me your opinion. Please use also menu Tools > Messages to see actual text value and id value.

According to me, w:set_text( text ) and w:get_text() should work properly also with dropdown widget: w:set_text(id) to select a list item accorging to its unique id, w:get_text() to read text value of selected item and w:get_value() to read id value of selected item.

So, is it a bug report or a feature request that should be or will be fixed or implemented or no? Thanks in advance for replies.

Edited by Pierre Ynard
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information